blob: e378e1fe9e265b1b262cbed96f126c02cf8102a9 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
2// Copyright Aleksey Gurtovoy 2000-2004
3//
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)
7//
8// See http://www.boost.org/libs/mpl for documentation.
9
10// $Id: logical_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
11// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $
12// $Revision: 49267 $
13
14// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION!
15
16#if !defined(BOOST_MPL_PREPROCESSING_MODE)
17# include <ndnboost/mpl/bool.hpp>
18# include <ndnboost/mpl/aux_/nested_type_wknd.hpp>
19# include <ndnboost/mpl/aux_/na_spec.hpp>
20# include <ndnboost/mpl/aux_/lambda_support.hpp>
21#endif
22
23#include <ndnboost/mpl/limits/arity.hpp>
24#include <ndnboost/mpl/aux_/preprocessor/params.hpp>
25#include <ndnboost/mpl/aux_/preprocessor/ext_params.hpp>
26#include <ndnboost/mpl/aux_/preprocessor/def_params_tail.hpp>
27#include <ndnboost/mpl/aux_/preprocessor/enum.hpp>
28#include <ndnboost/mpl/aux_/preprocessor/sub.hpp>
29#include <ndnboost/mpl/aux_/config/ctps.hpp>
30#include <ndnboost/mpl/aux_/config/workaround.hpp>
31
32#include <ndnboost/preprocessor/dec.hpp>
33#include <ndnboost/preprocessor/inc.hpp>
34#include <ndnboost/preprocessor/cat.hpp>
35
36namespace ndnboost { namespace mpl {
37
38# define AUX778076_PARAMS(param, sub) \
39 BOOST_MPL_PP_PARAMS( \
40 BOOST_MPL_PP_SUB(BOOST_MPL_LIMIT_METAFUNCTION_ARITY, sub) \
41 , param \
42 ) \
43 /**/
44
45# define AUX778076_SHIFTED_PARAMS(param, sub) \
46 BOOST_MPL_PP_EXT_PARAMS( \
47 2, BOOST_MPL_PP_SUB(BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY), sub) \
48 , param \
49 ) \
50 /**/
51
52# define AUX778076_SPEC_PARAMS(param) \
53 BOOST_MPL_PP_ENUM( \
54 BOOST_PP_DEC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \
55 , param \
56 ) \
57 /**/
58
59namespace aux {
60
61#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
62
63template< bool C_, AUX778076_PARAMS(typename T, 1) >
64struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)
65 : BOOST_PP_CAT(AUX778076_OP_VALUE1,_)
66{
67};
68
69template< AUX778076_PARAMS(typename T, 1) >
70struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)< AUX778076_OP_VALUE2,AUX778076_PARAMS(T, 1) >
71 : BOOST_PP_CAT(AUX778076_OP_NAME,impl)<
72 BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
73 , AUX778076_SHIFTED_PARAMS(T, 1)
74 , BOOST_PP_CAT(AUX778076_OP_VALUE2,_)
75 >
76{
77};
78
79template<>
80struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)<
81 AUX778076_OP_VALUE2
82 , AUX778076_SPEC_PARAMS(BOOST_PP_CAT(AUX778076_OP_VALUE2,_))
83 >
84 : BOOST_PP_CAT(AUX778076_OP_VALUE2,_)
85{
86};
87
88#else
89
90template< bool C_ > struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)
91{
92 template< AUX778076_PARAMS(typename T, 1) > struct result_
93 : BOOST_PP_CAT(AUX778076_OP_VALUE1,_)
94 {
95 };
96};
97
98template<> struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)<AUX778076_OP_VALUE2>
99{
100 template< AUX778076_PARAMS(typename T, 1) > struct result_
101 : BOOST_PP_CAT(AUX778076_OP_NAME,impl)<
102 BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
103 >::template result_< AUX778076_SHIFTED_PARAMS(T,1),BOOST_PP_CAT(AUX778076_OP_VALUE2,_) >
104 {
105 };
106
107#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
108 template<> struct result_<AUX778076_SPEC_PARAMS(BOOST_PP_CAT(AUX778076_OP_VALUE2,_))>
109 : BOOST_PP_CAT(AUX778076_OP_VALUE2,_)
110 {
111 };
112};
113#else
114};
115
116template<>
117struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)<AUX778076_OP_VALUE2>
118 ::result_< AUX778076_SPEC_PARAMS(BOOST_PP_CAT(AUX778076_OP_VALUE2,_)) >
119 : BOOST_PP_CAT(AUX778076_OP_VALUE2,_)
120{
121};
122#endif // BOOST_MSVC == 1300
123
124#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
125
126} // namespace aux
127
128template<
129 typename BOOST_MPL_AUX_NA_PARAM(T1)
130 , typename BOOST_MPL_AUX_NA_PARAM(T2)
131 BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename T, BOOST_PP_CAT(AUX778076_OP_VALUE2,_))
132 >
133struct AUX778076_OP_NAME
134#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
135 : aux::BOOST_PP_CAT(AUX778076_OP_NAME,impl)<
136 BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
137 , AUX778076_SHIFTED_PARAMS(T,0)
138 >
139#else
140 : aux::BOOST_PP_CAT(AUX778076_OP_NAME,impl)<
141 BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
142 >::template result_< AUX778076_SHIFTED_PARAMS(T,0) >
143#endif
144{
145 BOOST_MPL_AUX_LAMBDA_SUPPORT(
146 BOOST_MPL_LIMIT_METAFUNCTION_ARITY
147 , AUX778076_OP_NAME
148 , (AUX778076_PARAMS(T, 0))
149 )
150};
151
152BOOST_MPL_AUX_NA_SPEC2(
153 2
154 , BOOST_MPL_LIMIT_METAFUNCTION_ARITY
155 , AUX778076_OP_NAME
156 )
157
158}}
159
160#undef AUX778076_SPEC_PARAMS
161#undef AUX778076_SHIFTED_PARAMS
162#undef AUX778076_PARAMS
163#undef AUX778076_OP_NAME
164#undef AUX778076_OP_VALUE1
165#undef AUX778076_OP_VALUE2