@@ -33,6 +33,7 @@ namespace sr | |||
{ | |||
return true; | |||
} | |||
}; | |||
} |
@@ -42,8 +42,13 @@ namespace sr | |||
int m_uncaught_on_creation = uncaught_exceptions(); | |||
}; | |||
template<class F> | |||
constexpr bool is_noexcept_dtor_v<F, scope_fail_strategy> = noexcept(std::declval<F>()()); | |||
} | |||
@@ -54,7 +59,6 @@ namespace sr | |||
using detail::scope_guard_base<EF, detail::scope_fail_strategy>::scope_guard_base; | |||
private: | |||
}; |
@@ -28,6 +28,10 @@ namespace sr | |||
namespace detail | |||
{ | |||
template<class F, class S> | |||
constexpr bool is_noexcept_dtor_v = true; | |||
template<class EF, class Strategy> | |||
class scope_guard_base : private Strategy | |||
{ | |||
@@ -83,7 +87,8 @@ namespace detail | |||
scope_guard_base(const scope_guard_base&) = delete; | |||
~scope_guard_base() noexcept(true) | |||
~scope_guard_base() noexcept(is_noexcept_dtor_v<EF, Strategy>) | |||
{ | |||
if( (m_execute_on_destruction == true) && (this->should_execute() == true) ) | |||
{ |
@@ -40,7 +40,6 @@ namespace sr | |||
return ( std::uncaught_exception() == true ? 1 : 0 ); | |||
} | |||
int m_uncaught_on_creation = uncaught_exceptions(); | |||
}; | |||