Browse Source

Typetrait added instead of templated variable.

main
offa 7 years ago
parent
commit
5d396b25ef
2 changed files with 9 additions and 3 deletions
  1. +5
    -2
      include/detail/scope_guard_base.h
  2. +4
    -1
      include/scope_fail.h

+ 5
- 2
include/detail/scope_guard_base.h View File

{ {


template<class F, class S> template<class F, class S>
constexpr bool is_noexcept_dtor_v = true;
struct is_noexcept_dtor
{
static constexpr bool value = true;
};




template<class EF, class Strategy> template<class EF, class Strategy>
scope_guard_base(const scope_guard_base&) = delete; scope_guard_base(const scope_guard_base&) = delete;




~scope_guard_base() noexcept(is_noexcept_dtor_v<EF, Strategy>)
~scope_guard_base() noexcept(is_noexcept_dtor<EF, Strategy>::value)
{ {
if( (m_execute_on_destruction == true) && (this->should_execute() == true) ) if( (m_execute_on_destruction == true) && (this->should_execute() == true) )
{ {

+ 4
- 1
include/scope_fail.h View File





template<class F> template<class F>
constexpr bool is_noexcept_dtor_v<F, scope_fail_strategy> = noexcept(std::declval<F>()());
struct is_noexcept_dtor<F, scope_fail_strategy>
{
static constexpr bool value = noexcept(std::declval<F>()());
};


} }



Loading…
Cancel
Save