1 | |
2 | // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION |
3 | |
4 | // Copyright Aleksey Gurtovoy 2002-2004 |
5 | // |
6 | // Distributed under the Boost Software License, Version 1.0. |
7 | // (See accompanying file LICENSE_1_0.txt or copy at |
8 | // http://www.boost.org/LICENSE_1_0.txt) |
9 | |
10 | // $Source$ |
11 | // $Date$ |
12 | // $Revision$ |
13 | |
14 | // |
15 | // This header is deprecated and no longer used by type_traits: |
16 | // |
17 | #if defined(__GNUC__) || defined(_MSC_VER) |
18 | # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated") |
19 | #endif |
20 | |
21 | #include <boost/type_traits/detail/template_arity_spec.hpp> |
22 | #include <boost/type_traits/integral_constant.hpp> |
23 | #include <boost/config.hpp> |
24 | |
25 | // |
26 | // Unfortunately some libraries have started using this header without |
27 | // cleaning up afterwards: so we'd better undef the macros just in case |
28 | // they've been defined already.... |
29 | // |
30 | #ifdef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL |
31 | #undef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL |
32 | #undef BOOST_TT_AUX_BOOL_C_BASE |
33 | #undef BOOST_TT_AUX_BOOL_TRAIT_DEF1 |
34 | #undef BOOST_TT_AUX_BOOL_TRAIT_DEF2 |
35 | #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC1 |
36 | #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC2 |
37 | #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1 |
38 | #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2 |
39 | #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1 |
40 | #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2 |
41 | #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1 |
42 | #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2 |
43 | #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1 |
44 | #undef BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1 |
45 | #endif |
46 | |
47 | #ifndef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL |
48 | # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) /**/ |
49 | #endif |
50 | |
51 | #ifndef BOOST_TT_AUX_BOOL_C_BASE |
52 | # define BOOST_TT_AUX_BOOL_C_BASE(C) : public ::boost::integral_constant<bool,C> |
53 | #endif |
54 | |
55 | |
56 | #define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \ |
57 | template< typename T > struct trait \ |
58 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
59 | { \ |
60 | public:\ |
61 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
62 | }; \ |
63 | \ |
64 | BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ |
65 | /**/ |
66 | |
67 | |
68 | #define BOOST_TT_AUX_BOOL_TRAIT_DEF2(trait,T1,T2,C) \ |
69 | template< typename T1, typename T2 > struct trait \ |
70 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
71 | { \ |
72 | public:\ |
73 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
74 | }; \ |
75 | \ |
76 | BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \ |
77 | /**/ |
78 | |
79 | #define BOOST_TT_AUX_BOOL_TRAIT_DEF3(trait,T1,T2,T3,C) \ |
80 | template< typename T1, typename T2, typename T3 > struct trait \ |
81 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
82 | { \ |
83 | public:\ |
84 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
85 | }; \ |
86 | \ |
87 | BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(3,trait) \ |
88 | /**/ |
89 | |
90 | #define BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,C) \ |
91 | template<> struct trait< sp > \ |
92 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
93 | { \ |
94 | public:\ |
95 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
96 | }; \ |
97 | /**/ |
98 | |
99 | #define BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,sp1,sp2,C) \ |
100 | template<> struct trait< sp1,sp2 > \ |
101 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
102 | { \ |
103 | public:\ |
104 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
105 | }; \ |
106 | /**/ |
107 | |
108 | #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \ |
109 | template<> struct trait##_impl< sp > \ |
110 | { \ |
111 | public:\ |
112 | BOOST_STATIC_CONSTANT(bool, value = (C)); \ |
113 | }; \ |
114 | /**/ |
115 | |
116 | #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \ |
117 | template<> struct trait##_impl< sp1,sp2 > \ |
118 | { \ |
119 | public:\ |
120 | BOOST_STATIC_CONSTANT(bool, value = (C)); \ |
121 | }; \ |
122 | /**/ |
123 | |
124 | #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(param,trait,sp,C) \ |
125 | template< param > struct trait< sp > \ |
126 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
127 | { \ |
128 | public:\ |
129 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
130 | }; \ |
131 | /**/ |
132 | |
133 | #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(param1,param2,trait,sp,C) \ |
134 | template< param1, param2 > struct trait< sp > \ |
135 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
136 | { \ |
137 | public:\ |
138 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
139 | }; \ |
140 | /**/ |
141 | |
142 | #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \ |
143 | template< param > struct trait< sp1,sp2 > \ |
144 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
145 | { \ |
146 | public:\ |
147 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
148 | }; \ |
149 | /**/ |
150 | |
151 | #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(param1,param2,trait,sp1,sp2,C) \ |
152 | template< param1, param2 > struct trait< sp1,sp2 > \ |
153 | BOOST_TT_AUX_BOOL_C_BASE(C) \ |
154 | { \ |
155 | public:\ |
156 | BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ |
157 | }; \ |
158 | /**/ |
159 | |
160 | #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \ |
161 | template< param > struct trait##_impl< sp1,sp2 > \ |
162 | { \ |
163 | public:\ |
164 | BOOST_STATIC_CONSTANT(bool, value = (C)); \ |
165 | }; \ |
166 | /**/ |
167 | |
168 | #ifndef BOOST_NO_CV_SPECIALIZATIONS |
169 | # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \ |
170 | BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \ |
171 | BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const,value) \ |
172 | BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp volatile,value) \ |
173 | BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const volatile,value) \ |
174 | /**/ |
175 | #else |
176 | # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \ |
177 | BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \ |
178 | /**/ |
179 | #endif |
180 | |