source: NonGTP/Boost/boost/type_traits/detail/bool_trait_def.hpp @ 857

Revision 857, 4.3 KB checked in by igarcia, 18 years ago (diff)
Line 
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: /cvsroot/boost/boost/boost/type_traits/detail/bool_trait_def.hpp,v $
11// $Date: 2005/03/16 12:22:22 $
12// $Revision: 1.18 $
13
14#include <boost/type_traits/detail/template_arity_spec.hpp>
15#include <boost/type_traits/integral_constant.hpp>
16#include <boost/mpl/bool.hpp>
17#include <boost/mpl/aux_/lambda_support.hpp>
18#include <boost/config.hpp>
19
20#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x570)
21#   define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
22    typedef ::boost::integral_constant<bool,C> type; \
23    enum { value = type::value }; \
24    /**/
25#   define BOOST_TT_AUX_BOOL_C_BASE(C)
26
27#elif defined(BOOST_MSVC) && BOOST_MSVC <= 1200
28
29#   define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
30    typedef ::boost::integral_constant<bool,C> base_; \
31    using base_::value; \
32    /**/
33
34#endif
35
36#ifndef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
37#   define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) /**/
38#endif
39
40#ifndef BOOST_TT_AUX_BOOL_C_BASE
41#   define BOOST_TT_AUX_BOOL_C_BASE(C) : ::boost::integral_constant<bool,C>
42#endif
43
44
45#define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \
46template< typename T > struct trait \
47    BOOST_TT_AUX_BOOL_C_BASE(C) \
48{ \
49    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
50    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \
51}; \
52\
53BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \
54/**/
55
56
57#define BOOST_TT_AUX_BOOL_TRAIT_DEF2(trait,T1,T2,C) \
58template< typename T1, typename T2 > struct trait \
59    BOOST_TT_AUX_BOOL_C_BASE(C) \
60{ \
61    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
62    BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \
63}; \
64\
65BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \
66/**/
67
68#define BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,C) \
69template<> struct trait< sp > \
70    BOOST_TT_AUX_BOOL_C_BASE(C) \
71{ \
72    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
73    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(sp)) \
74}; \
75/**/
76
77#define BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,sp1,sp2,C) \
78template<> struct trait< sp1,sp2 > \
79    BOOST_TT_AUX_BOOL_C_BASE(C) \
80{ \
81    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
82    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \
83}; \
84/**/
85
86#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \
87template<> struct trait##_impl< sp > \
88{ \
89    BOOST_STATIC_CONSTANT(bool, value = (C)); \
90}; \
91/**/
92
93#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \
94template<> struct trait##_impl< sp1,sp2 > \
95{ \
96    BOOST_STATIC_CONSTANT(bool, value = (C)); \
97}; \
98/**/
99
100#define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(param,trait,sp,C) \
101template< param > struct trait< sp > \
102    BOOST_TT_AUX_BOOL_C_BASE(C) \
103{ \
104    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
105}; \
106/**/
107
108#define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(param1,param2,trait,sp,C) \
109template< param1, param2 > struct trait< sp > \
110    BOOST_TT_AUX_BOOL_C_BASE(C) \
111{ \
112    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
113}; \
114/**/
115
116#define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
117template< param > struct trait< sp1,sp2 > \
118    BOOST_TT_AUX_BOOL_C_BASE(C) \
119{ \
120    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
121    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \
122}; \
123/**/
124
125#define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(param1,param2,trait,sp1,sp2,C) \
126template< param1, param2 > struct trait< sp1,sp2 > \
127    BOOST_TT_AUX_BOOL_C_BASE(C) \
128{ \
129    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
130}; \
131/**/
132
133#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
134template< param > struct trait##_impl< sp1,sp2 > \
135{ \
136    BOOST_STATIC_CONSTANT(bool, value = (C)); \
137}; \
138/**/
139
140#ifndef BOOST_NO_CV_SPECIALIZATIONS
141#   define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \
142    BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
143    BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const,value) \
144    BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp volatile,value) \
145    BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const volatile,value) \
146    /**/
147#else
148#   define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \
149    BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
150    /**/
151#endif
Note: See TracBrowser for help on using the repository browser.