Browse Source

Refactoring, both mctor's can be merged into one.

main
offa 7 years ago
parent
commit
b9cce110e6
1 changed files with 0 additions and 16 deletions
  1. +0
    -16
      include/unique_resource.h

+ 0
- 16
include/unique_resource.h View File

d(r); d(r);
} }


template<class TR = R, class TD = D,
std::enable_if_t<(std::is_nothrow_move_constructible<TR>::value
&& std::is_nothrow_move_constructible<TD>::value), int> = 0
>
unique_resource(unique_resource&& other) noexcept(std::is_nothrow_move_constructible<R>::value unique_resource(unique_resource&& other) noexcept(std::is_nothrow_move_constructible<R>::value
&& std::is_nothrow_move_constructible<D>::value) && std::is_nothrow_move_constructible<D>::value)
: m_resource(forward_if_nothrow_move_constructible<R>(std::forward<R>(other.m_resource))), : m_resource(forward_if_nothrow_move_constructible<R>(std::forward<R>(other.m_resource))),
{ {
} }


template<class TR = R, class TD = D,
std::enable_if_t<(!std::is_nothrow_move_constructible<TR>::value
|| !std::is_nothrow_move_constructible<TD>::value), int> = 0
>
unique_resource(unique_resource&& other) noexcept(std::is_nothrow_move_constructible<R>::value
&& std::is_nothrow_move_constructible<D>::value)
: m_resource(other.m_resource),
m_deleter(other.m_deleter),
m_execute_on_destruction(std::exchange(other.m_execute_on_destruction, false))
{
}

unique_resource(const unique_resource&) = delete; unique_resource(const unique_resource&) = delete;


~unique_resource() ~unique_resource()

Loading…
Cancel
Save