|
|
|
|
|
|
|
|
template<class F, class S> |
|
|
template<class F, class S> |
|
|
constexpr bool is_noexcept_dtor_v = is_noexcept_dtor<F, S>::value; |
|
|
constexpr bool is_noexcept_dtor_v = is_noexcept_dtor<F, S>::value; |
|
|
|
|
|
|
|
|
|
|
|
template<class T> |
|
|
|
|
|
constexpr decltype(auto) forward_if_nothrow_move_constructible(T&& arg) |
|
|
|
|
|
{ |
|
|
|
|
|
if constexpr( std::is_nothrow_move_constructible_v<T> == true ) |
|
|
|
|
|
{ |
|
|
|
|
|
return std::forward<T>(arg); |
|
|
|
|
|
} |
|
|
|
|
|
return arg; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class EF, class Strategy> |
|
|
template<class EF, class Strategy> |
|
|
|
|
|
|
|
|
throw; |
|
|
throw; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<class EFP = EF, std::enable_if_t<(std::is_nothrow_move_constructible_v<EF> |
|
|
|
|
|
|| std::is_copy_constructible_v<EF>), int> = 0 |
|
|
|
|
|
> |
|
|
scope_guard_base(scope_guard_base&& other) noexcept(std::is_nothrow_move_constructible_v<EF> |
|
|
scope_guard_base(scope_guard_base&& other) noexcept(std::is_nothrow_move_constructible_v<EF> |
|
|
|| std::is_nothrow_copy_constructible_v<EF>) |
|
|
|| std::is_nothrow_copy_constructible_v<EF>) |
|
|
: Strategy(other), |
|
|
: Strategy(other), |
|
|
m_exitfunction(std::forward<EF>(other.m_exitfunction)), |
|
|
|
|
|
|
|
|
m_exitfunction(forward_if_nothrow_move_constructible(other.m_exitfunction)), |
|
|
m_execute_on_destruction(other.m_execute_on_destruction) |
|
|
m_execute_on_destruction(other.m_execute_on_destruction) |
|
|
{ |
|
|
{ |
|
|
other.release(); |
|
|
other.release(); |