Pārlūkot izejas kodu

Typetrait added instead of templated variable.

main
offa pirms 7 gadiem
vecāks
revīzija
5d396b25ef
2 mainītis faili ar 9 papildinājumiem un 3 dzēšanām
  1. +5
    -2
      include/detail/scope_guard_base.h
  2. +4
    -1
      include/scope_fail.h

+ 5
- 2
include/detail/scope_guard_base.h Parādīt failu

@@ -29,7 +29,10 @@ namespace detail
{

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>
@@ -88,7 +91,7 @@ namespace detail
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) )
{

+ 4
- 1
include/scope_fail.h Parādīt failu

@@ -47,7 +47,10 @@ namespace sr


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>()());
};

}


Notiek ielāde…
Atcelt
Saglabāt