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