diff --git a/scope_guard.hpp b/scope_guard.hpp index bc34b69..5913b59 100644 --- a/scope_guard.hpp +++ b/scope_guard.hpp @@ -84,22 +84,22 @@ namespace sg std::is_nothrow_destructible> {}; - template class ShouldRun; - template<> class ShouldRun { + template struct ShouldRun; + template<> struct ShouldRun { constexpr static bool should_run() { return true; } }; -#if __cplusplus >= 202002L - template<> class ShouldRun { +#if __cplusplus >= 201703L + template<> struct ShouldRun { static bool should_run() { return std::uncaught_exceptions() == 0; } }; - template<> class ShouldRun { + template<> struct ShouldRun { static bool should_run() { return std::uncaught_exceptions() != 0; } }; #elif __cplusplus >= 201411L - template<> class ShouldRun { + template<> struct ShouldRun { static bool should_run() { return !std::uncaught_exception(); } }; - template<> class ShouldRun { + template<> struct ShouldRun { static bool should_run() { return std::uncaught_exception(); } }; #endif