1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2015-2015.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/libs/move for documentation.
10 //////////////////////////////////////////////////////////////////////////////
14 #ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP
15 #define BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP
17 #ifndef BOOST_CONFIG_HPP
18 # include <boost/config.hpp>
21 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 //Small meta-typetraits to support move
28 namespace move_detail {
30 //////////////////////////////////////
32 //////////////////////////////////////
33 template<bool C, typename T1, typename T2>
39 template<typename T1, typename T2>
40 struct if_c<false,T1,T2>
45 //////////////////////////////////////
47 //////////////////////////////////////
48 template<typename T1, typename T2, typename T3>
49 struct if_ : if_c<0 != T1::value, T2, T3>
52 //////////////////////////////////////
54 //////////////////////////////////////
55 template <bool B, class T = void>
62 struct enable_if_c<false, T> {};
64 //////////////////////////////////////
66 //////////////////////////////////////
67 template <class Cond, class T = void>
68 struct enable_if : enable_if_c<Cond::value, T> {};
70 //////////////////////////////////////
72 //////////////////////////////////////
73 template <bool B, class T = void>
78 //////////////////////////////////////
80 //////////////////////////////////////
81 template <class Cond, class T = void>
82 struct disable_if : enable_if_c<!Cond::value, T> {};
84 //////////////////////////////////////
86 //////////////////////////////////////
87 template<class T, T v>
88 struct integral_constant
90 static const T value = v;
92 typedef integral_constant<T, v> type;
94 operator T() const { return value; }
95 T operator()() const { return value; }
98 typedef integral_constant<bool, true > true_type;
99 typedef integral_constant<bool, false > false_type;
102 //////////////////////////////////////
104 //////////////////////////////////////
105 template<class T, class U>
108 static const bool value = false;
114 static const bool value = true;
117 //////////////////////////////////////
119 //////////////////////////////////////
120 template <class T, class U, class R = void>
121 struct enable_if_same : enable_if<is_same<T, U>, R> {};
123 //////////////////////////////////////
125 //////////////////////////////////////
126 template <class T, class U, class R = void>
127 struct disable_if_same : disable_if<is_same<T, U>, R> {};
129 } //namespace move_detail {
130 } //namespace boost {
132 #endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP