Browse Source

Using new trait helper variables.

main
offa 7 years ago
parent
commit
87c02ce3f4
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      include/detail/wrapper.h

+ 4
- 4
include/detail/wrapper.h View File

{ {
public: public:


template<class TT, class G, std::enable_if_t<std::is_constructible<T, TT>::value, int> = 0>
template<class TT, class G, std::enable_if_t<std::is_constructible_v<T, TT>, int> = 0>
explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(Wrapper{value})) : Wrapper(value) explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(Wrapper{value})) : Wrapper(value)
{ {
g.release(); g.release();
return m_value; return m_value;
} }


void reset(T&& newValue) noexcept(std::is_nothrow_assignable<T, decltype(std::move_if_noexcept(newValue))>::value)
void reset(T&& newValue) noexcept(std::is_nothrow_assignable_v<T, decltype(std::move_if_noexcept(newValue))>)
{ {
m_value = std::move_if_noexcept(newValue); m_value = std::move_if_noexcept(newValue);
} }


void reset(const T& newValue) noexcept(std::is_nothrow_assignable<T, const T&>::value)
void reset(const T& newValue) noexcept(std::is_nothrow_assignable_v<T, const T&>)
{ {
m_value = newValue; m_value = newValue;
} }
{ {
public: public:


template<class TT, class G, std::enable_if_t<std::is_convertible<TT, T&>::value, int> = 0>
template<class TT, class G, std::enable_if_t<std::is_convertible_v<TT, T&>, int> = 0>
explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(static_cast<T&>(value))) : m_value(static_cast<T&>(value)) explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(static_cast<T&>(value))) : m_value(static_cast<T&>(value))
{ {
g.release(); g.release();

Loading…
Cancel
Save