Browse Source

Diction unified.

main
offa 7 years ago
parent
commit
ed85b84bad
2 changed files with 7 additions and 7 deletions
  1. +5
    -5
      include/detail/scope_guard_base.h
  2. +2
    -2
      include/unique_resource.h

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

std::enable_if_t<(!std::is_lvalue_reference<EFP>::value) std::enable_if_t<(!std::is_lvalue_reference<EFP>::value)
&& std::is_nothrow_constructible<EF, EFP>::value, int> = 0 && std::is_nothrow_constructible<EF, EFP>::value, int> = 0
> >
explicit scope_guard_base(EFP&& exitFunction) : m_exitFunction(std::move(exitFunction)),
explicit scope_guard_base(EFP&& exitFunction) : m_exitfunction(std::move(exitFunction)),
m_execute_on_destruction(true) m_execute_on_destruction(true)
{ {
} }
std::enable_if_t<std::is_constructible<EF, EFP>::value, int> = 0, std::enable_if_t<std::is_constructible<EF, EFP>::value, int> = 0,
std::enable_if_t<std::is_lvalue_reference<EFP>::value, int> = 0 std::enable_if_t<std::is_lvalue_reference<EFP>::value, int> = 0
> >
explicit scope_guard_base(EFP&& exitFunction) try : m_exitFunction(exitFunction),
explicit scope_guard_base(EFP&& exitFunction) try : m_exitfunction(exitFunction),
m_execute_on_destruction(true) m_execute_on_destruction(true)
{ {
} }
scope_guard_base(scope_guard_base&& other) noexcept(std::is_nothrow_move_constructible<EF>::value scope_guard_base(scope_guard_base&& other) noexcept(std::is_nothrow_move_constructible<EF>::value
|| std::is_nothrow_copy_constructible<EF>::value) || std::is_nothrow_copy_constructible<EF>::value)
: Strategy(other), : Strategy(other),
m_exitFunction(std::move_if_noexcept(other.m_exitFunction)),
m_exitfunction(std::move_if_noexcept(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();
{ {
if( (m_execute_on_destruction == true) && (this->should_execute() == true) ) if( (m_execute_on_destruction == true) && (this->should_execute() == true) )
{ {
m_exitFunction();
m_exitfunction();
} }
} }




private: private:


EF m_exitFunction;
EF m_exitfunction;
bool m_execute_on_destruction; bool m_execute_on_destruction;
}; };



+ 2
- 2
include/unique_resource.h View File

noexcept(std::is_nothrow_constructible<std::decay_t<R>, R>::value noexcept(std::is_nothrow_constructible<std::decay_t<R>, R>::value
&& std::is_nothrow_constructible<std::decay_t<D>, D>::value) && std::is_nothrow_constructible<std::decay_t<D>, D>::value)
{ {
const bool mustRelease{r == invalid};
const bool must_release{r == invalid};
auto ur = make_unique_resource(r, d); auto ur = make_unique_resource(r, d);


if( mustRelease == true )
if( must_release == true )
{ {
ur.release(); ur.release();
} }

Loading…
Cancel
Save