| && std::is_nothrow_constructible<R, RR>::value, int> = 0, | && std::is_nothrow_constructible<R, RR>::value, int> = 0, | ||||
| std::enable_if_t<(!std::is_lvalue_reference<DD>::value) | std::enable_if_t<(!std::is_lvalue_reference<DD>::value) | ||||
| && std::is_nothrow_constructible<D, DD>::value, int> = 0, | && std::is_nothrow_constructible<D, DD>::value, int> = 0, | ||||
| std::enable_if_t<(std::is_copy_constructible<R>::value || std::is_nothrow_move_constructible<R>::value) | std::enable_if_t<(std::is_copy_constructible<R>::value || std::is_nothrow_move_constructible<R>::value) | ||||
| && (std::is_copy_constructible<D>::value || std::is_nothrow_move_constructible<D>::value), int> = 0, | && (std::is_copy_constructible<D>::value || std::is_nothrow_move_constructible<D>::value), int> = 0, | ||||
| std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<R, RR>, int> = 0, | std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<R, RR>, int> = 0, | ||||
| std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<D, DD>, int> = 0 | std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<D, DD>, int> = 0 | ||||
| > | > | ||||
| explicit unique_resource(RR&& r, DD&& d) : m_resource(std::move(r)), m_deleter(std::move(d)), m_execute_on_destruction(true) | |||||
| explicit unique_resource(RR&& r, DD&& d) noexcept(std::is_nothrow_constructible<R,RR>::value | |||||
| && std::is_nothrow_constructible<D, DD>::value) | |||||
| : m_resource(std::move(r)), | |||||
| m_deleter(std::move(d)), | |||||
| m_execute_on_destruction(true) | |||||
| { | { | ||||
| } | } | ||||
| template<class RR, class DD, | template<class RR, class DD, | ||||
| std::enable_if_t<std::is_lvalue_reference<RR>::value || std::is_lvalue_reference<DD>::value, int> = 0, | std::enable_if_t<std::is_lvalue_reference<RR>::value || std::is_lvalue_reference<DD>::value, int> = 0, | ||||
| std::enable_if_t<(std::is_copy_constructible<R>::value || std::is_nothrow_move_constructible<R>::value) | std::enable_if_t<(std::is_copy_constructible<R>::value || std::is_nothrow_move_constructible<R>::value) | ||||
| && (std::is_copy_constructible<D>::value || std::is_nothrow_move_constructible<D>::value), int> = 0, | && (std::is_copy_constructible<D>::value || std::is_nothrow_move_constructible<D>::value), int> = 0, | ||||
| std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<R, RR>, int> = 0, | std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<R, RR>, int> = 0, | ||||
| std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<D, DD>, int> = 0 | std::enable_if_t<is_nothrow_move_or_copy_constructible_from_v<D, DD>, int> = 0 | ||||
| > | > | ||||
| explicit unique_resource(RR&& r, DD&& d) try : m_resource(r), m_deleter(d), m_execute_on_destruction(true) | |||||
| explicit unique_resource(RR&& r, DD&& d) noexcept(std::is_nothrow_constructible<R, RR>::value | |||||
| && std::is_nothrow_constructible<D, DD>::value) | |||||
| try : m_resource(r), | |||||
| m_deleter(d), | |||||
| m_execute_on_destruction(true) | |||||
| { | { | ||||
| } | } | ||||
| catch( ... ) | catch( ... ) | ||||
| std::enable_if_t<(std::is_nothrow_move_constructible<TR>::value | std::enable_if_t<(std::is_nothrow_move_constructible<TR>::value | ||||
| && std::is_nothrow_move_constructible<TD>::value), int> = 0 | && std::is_nothrow_move_constructible<TD>::value), int> = 0 | ||||
| > | > | ||||
| unique_resource(unique_resource&& other) : m_resource(std::forward<R>(other.m_resource)), | |||||
| unique_resource(unique_resource&& other) noexcept(std::is_nothrow_move_constructible<R>::value | |||||
| && std::is_nothrow_move_constructible<D>::value) | |||||
| : m_resource(std::forward<R>(other.m_resource)), | |||||
| m_deleter(std::forward<D>(other.m_deleter)), | m_deleter(std::forward<D>(other.m_deleter)), | ||||
| m_execute_on_destruction(std::exchange(other.m_execute_on_destruction, false)) | m_execute_on_destruction(std::exchange(other.m_execute_on_destruction, false)) | ||||
| { | { | ||||
| std::enable_if_t<(!std::is_nothrow_move_constructible<TR>::value | std::enable_if_t<(!std::is_nothrow_move_constructible<TR>::value | ||||
| || !std::is_nothrow_move_constructible<TD>::value), int> = 0 | || !std::is_nothrow_move_constructible<TD>::value), int> = 0 | ||||
| > | > | ||||
| unique_resource(unique_resource&& other) : m_resource(other.m_resource), | |||||
| 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_deleter(other.m_deleter), | ||||
| m_execute_on_destruction(std::exchange(other.m_execute_on_destruction, false)) | m_execute_on_destruction(std::exchange(other.m_execute_on_destruction, false)) | ||||
| { | { |