Ver código fonte

Setting the correct noexcept value depending on the strategy.

main
offa 7 anos atrás
pai
commit
6f3e9ac6d1
4 arquivos alterados com 12 adições e 3 exclusões
  1. +1
    -0
      include/scope_exit.h
  2. +5
    -1
      include/scope_fail.h
  3. +6
    -1
      include/scope_guard_base.h
  4. +0
    -1
      include/scope_success.h

+ 1
- 0
include/scope_exit.h Ver arquivo

@@ -33,6 +33,7 @@ namespace sr
{
return true;
}

};

}

+ 5
- 1
include/scope_fail.h Ver arquivo

@@ -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:

};

+ 6
- 1
include/scope_guard_base.h Ver arquivo

@@ -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) )
{

+ 0
- 1
include/scope_success.h Ver arquivo

@@ -40,7 +40,6 @@ namespace sr
return ( std::uncaught_exception() == true ? 1 : 0 );
}


int m_uncaught_on_creation = uncaught_exceptions();
};


Carregando…
Cancelar
Salvar