util: update function dtors, update gitignore

This commit is contained in:
Michael Scire 2022-03-13 13:51:15 -07:00
parent 244a396b16
commit 09a44fa680
2 changed files with 6 additions and 1 deletions

3
.gitignore vendored
View file

@ -93,6 +93,7 @@ dkms.conf
**/out **/out
**/build **/build
**/lib
**/build_nintendo_nx_arm64 **/build_nintendo_nx_arm64
**/build_nintendo_nx_arm64_armv8a **/build_nintendo_nx_arm64_armv8a
**/build_nintendo_nx_arm **/build_nintendo_nx_arm
@ -102,6 +103,8 @@ dkms.conf
**/build_nintendo_nx_x64 **/build_nintendo_nx_x64
**/build_nintendo_nx_x86 **/build_nintendo_nx_x86
tools/*/
package3 package3
stratosphere/test/ stratosphere/test/

View file

@ -58,6 +58,7 @@ namespace ams::util {
F m_f; F m_f;
public: public:
constexpr explicit Function(F f) : m_f(std::move(f)) { /* ... */} constexpr explicit Function(F f) : m_f(std::move(f)) { /* ... */}
constexpr virtual ~Function() override { /* ... */ }
constexpr virtual R operator()(Args... args) const override final { constexpr virtual R operator()(Args... args) const override final {
return m_f(std::forward<Args>(args)...); return m_f(std::forward<Args>(args)...);
@ -68,6 +69,7 @@ namespace ams::util {
class Function<R(Args...), F, typename std::enable_if<std::is_class<F>::value && !std::is_final<F>::value>::type> final : public IFunction<R(Args...)>, private F { class Function<R(Args...), F, typename std::enable_if<std::is_class<F>::value && !std::is_final<F>::value>::type> final : public IFunction<R(Args...)>, private F {
public: public:
constexpr explicit Function(F f) : F(std::move(f)) { /* ... */} constexpr explicit Function(F f) : F(std::move(f)) { /* ... */}
constexpr virtual ~Function() override { /* ... */ }
constexpr virtual R operator()(Args... args) const override final { constexpr virtual R operator()(Args... args) const override final {
return static_cast<const F &>(*this).operator()(std::forward<Args>(args)...); return static_cast<const F &>(*this).operator()(std::forward<Args>(args)...);
@ -90,7 +92,7 @@ namespace ams::util {
template<typename R, typename... Args> template<typename R, typename... Args>
class IFunction<R(Args...)> { class IFunction<R(Args...)> {
protected: protected:
constexpr virtual ~IFunction() = default; constexpr virtual ~IFunction() { /* ... */ };
public: public:
constexpr virtual R operator()(Args... args) const = 0; constexpr virtual R operator()(Args... args) const = 0;