浏览代码

Using class instead of struct.

main
offa 8 年前
父节点
当前提交
82031d03ad
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. +7
    -2
      include/detail/wrapper.h

+ 7
- 2
include/detail/wrapper.h 查看文件

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

正在加载...
取消
保存