]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/ice.hpp
update boost
[lyx.git] / boost / boost / type_traits / ice.hpp
1
2 //  (C) Copyright John Maddock and Steve Cleary 2000.
3 //  Permission to copy, use, modify, sell and
4 //  distribute this software is granted provided this copyright notice appears
5 //  in all copies. This software is provided "as is" without express or implied
6 //  warranty, and with no claim as to its suitability for any purpose.
7
8 //  See http://www.boost.org for most recent version including documentation.
9 //
10 //  macros and helpers for working with integral-constant-expressions.
11
12 #ifndef BOOST_ICE_TYPE_TRAITS_HPP
13 #define BOOST_ICE_TYPE_TRAITS_HPP
14
15 #ifndef BOOST_CONFIG_HPP
16 #include <boost/config.hpp>
17 #endif
18
19
20 namespace boost{
21 namespace type_traits{
22
23 typedef char yes_type;
24 typedef double no_type;
25
26 template <bool b>
27 struct ice_not
28 { BOOST_STATIC_CONSTANT(bool, value = true); };
29 template <>
30 struct ice_not<true>
31 { BOOST_STATIC_CONSTANT(bool, value = false); };
32
33 template <bool b1, bool b2, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false>
34 struct ice_or;
35 template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7>
36 struct ice_or
37 {
38    BOOST_STATIC_CONSTANT(bool, value = true);
39 };
40 template <>
41 struct ice_or<false, false, false, false, false, false, false>
42 {
43    BOOST_STATIC_CONSTANT(bool, value = false);
44 };
45
46 template <bool b1, bool b2, bool b3 = true, bool b4 = true, bool b5 = true, bool b6 = true, bool b7 = true>
47 struct ice_and;
48 template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7>
49 struct ice_and
50 {
51    BOOST_STATIC_CONSTANT(bool, value = false);
52 };
53 template <>
54 struct ice_and<true, true, true, true, true, true, true>
55 {
56    BOOST_STATIC_CONSTANT(bool, value = true);
57 };
58
59 template <int b1, int b2>
60 struct ice_eq
61 {
62    BOOST_STATIC_CONSTANT(bool, value = (b1 == b2));
63 };
64
65 template <int b1, int b2>
66 struct ice_ne
67 {
68    BOOST_STATIC_CONSTANT(bool, value = (b1 != b2));
69 };
70
71 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
72 template <int b1, int b2>
73 const bool ice_eq<b1,b2>::value;
74 template <int b1, int b2>
75 const bool ice_ne<b1,b2>::value;
76 #endif
77
78 } // namespace type_traits
79
80 } // namespace boost
81
82 #endif // BOOST_ICE_TYPE_TRAITS_HPP
83
84
85
86
87