Project revived from Feb2017
[EroSomnia.git] / deps / boost_1_63_0 / boost / core / enable_if.hpp
blob5dcef1e035406d32572fab0c4eca99403272bb9b
1 // Boost enable_if library
3 // Copyright 2003 (c) The Trustees of Indiana University.
5 // Use, modification, and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
10 // Jeremiah Willcock (jewillco at osl.iu.edu)
11 // Andrew Lumsdaine (lums at osl.iu.edu)
14 #ifndef BOOST_CORE_ENABLE_IF_HPP
15 #define BOOST_CORE_ENABLE_IF_HPP
17 #include "boost/config.hpp"
19 // Even the definition of enable_if causes problems on some compilers,
20 // so it's macroed out for all compilers that do not support SFINAE
22 #ifndef BOOST_NO_SFINAE
24 namespace boost
26 template<typename T, typename R=void>
27 struct enable_if_has_type
29 typedef R type;
32 template <bool B, class T = void>
33 struct enable_if_c {
34 typedef T type;
37 template <class T>
38 struct enable_if_c<false, T> {};
40 template <class Cond, class T = void>
41 struct enable_if : public enable_if_c<Cond::value, T> {};
43 template <bool B, class T>
44 struct lazy_enable_if_c {
45 typedef typename T::type type;
48 template <class T>
49 struct lazy_enable_if_c<false, T> {};
51 template <class Cond, class T>
52 struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
55 template <bool B, class T = void>
56 struct disable_if_c {
57 typedef T type;
60 template <class T>
61 struct disable_if_c<true, T> {};
63 template <class Cond, class T = void>
64 struct disable_if : public disable_if_c<Cond::value, T> {};
66 template <bool B, class T>
67 struct lazy_disable_if_c {
68 typedef typename T::type type;
71 template <class T>
72 struct lazy_disable_if_c<true, T> {};
74 template <class Cond, class T>
75 struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
77 } // namespace boost
79 #else
81 namespace boost {
83 namespace detail { typedef void enable_if_default_T; }
85 template <typename T>
86 struct enable_if_does_not_work_on_this_compiler;
88 template<typename T, typename R=void>
89 struct enable_if_has_type : enable_if_does_not_work_on_this_compiler<T>
90 { };
92 template <bool B, class T = detail::enable_if_default_T>
93 struct enable_if_c : enable_if_does_not_work_on_this_compiler<T>
94 { };
96 template <bool B, class T = detail::enable_if_default_T>
97 struct disable_if_c : enable_if_does_not_work_on_this_compiler<T>
98 { };
100 template <bool B, class T = detail::enable_if_default_T>
101 struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler<T>
102 { };
104 template <bool B, class T = detail::enable_if_default_T>
105 struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler<T>
106 { };
108 template <class Cond, class T = detail::enable_if_default_T>
109 struct enable_if : enable_if_does_not_work_on_this_compiler<T>
110 { };
112 template <class Cond, class T = detail::enable_if_default_T>
113 struct disable_if : enable_if_does_not_work_on_this_compiler<T>
114 { };
116 template <class Cond, class T = detail::enable_if_default_T>
117 struct lazy_enable_if : enable_if_does_not_work_on_this_compiler<T>
118 { };
120 template <class Cond, class T = detail::enable_if_default_T>
121 struct lazy_disable_if : enable_if_does_not_work_on_this_compiler<T>
122 { };
124 } // namespace boost
126 #endif // BOOST_NO_SFINAE
128 #endif