|
|
|
|
|
|
|
|
#pragma once |
|
|
#pragma once |
|
|
|
|
|
|
|
|
#include <functional> |
|
|
#include <functional> |
|
|
|
|
|
#include <type_traits> |
|
|
|
|
|
|
|
|
namespace sr |
|
|
namespace sr |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
template<class T> |
|
|
template<class T> |
|
|
struct Wrapper |
|
|
|
|
|
|
|
|
class Wrapper |
|
|
{ |
|
|
{ |
|
|
|
|
|
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<T, TT>::value, 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) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class T> |
|
|
template<class T> |
|
|
struct Wrapper<T&> |
|
|
|
|
|
|
|
|
class Wrapper<T&> |
|
|
{ |
|
|
{ |
|
|
|
|
|
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<TT, T&>::value, 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)) |
|
|
{ |
|
|
{ |