Browse Source

Using std::is_nothrow_swappable_v as the own implementation is not

longer needed in C++17.
main
offa 7 years ago
parent
commit
3b5c5c06e7
1 changed files with 3 additions and 8 deletions
  1. +3
    -8
      include/unique_resource.h

+ 3
- 8
include/unique_resource.h View File

constexpr auto is_nothrow_move_or_copy_constructible_from_v = is_ntmocp_constructible<T, TT>::value; constexpr auto is_nothrow_move_or_copy_constructible_from_v = is_ntmocp_constructible<T, TT>::value;




template<class T>
constexpr auto is_nothrow_swappable_v = std::is_nothrow_move_constructible_v<T>
&& std::is_nothrow_move_assignable_v<T>;




template<class T, class U = std::conditional_t<std::is_nothrow_move_constructible_v<T>, T&&, const T&>> template<class T, class U = std::conditional_t<std::is_nothrow_move_constructible_v<T>, T&&, const T&>>
constexpr U forward_if_nothrow_move_constructible(T&& value) noexcept constexpr U forward_if_nothrow_move_constructible(T&& value) noexcept
} }




void swap(unique_resource& other) noexcept(detail::is_nothrow_swappable_v<R>
&& detail::is_nothrow_swappable_v<D>
&& detail::is_nothrow_swappable_v<bool>)
void swap(unique_resource& other) noexcept(std::is_nothrow_swappable_v<R>
&& std::is_nothrow_swappable_v<D>
&& std::is_nothrow_swappable_v<bool>)
{ {
using std::swap; using std::swap;
swap(m_resource.get(), other.m_resource.get()); swap(m_resource.get(), other.m_resource.get());

Loading…
Cancel
Save