Browse Source

Using class instead of struct.

main
offa 7 years ago
parent
commit
82031d03ad
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      include/detail/wrapper.h

+ 7
- 2
include/detail/wrapper.h View File

#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))
{ {

Loading…
Cancel
Save