blob: 4d06cc586cbd8e99298f882a8b32079120ace832 [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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070016#if !defined(NDNBOOST_MPL_PREPROCESSING_MODE)
Jeff Thompsona28eed82013-08-22 16:21:10 -070017# 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) \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070039 NDNBOOST_MPL_PP_PARAMS( \
40 NDNBOOST_MPL_PP_SUB(NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY, sub) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070041 , param \
42 ) \
43 /**/
44
45# define AUX778076_SHIFTED_PARAMS(param, sub) \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070046 NDNBOOST_MPL_PP_EXT_PARAMS( \
47 2, NDNBOOST_MPL_PP_SUB(NDNBOOST_PP_INC(NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY), sub) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070048 , param \
49 ) \
50 /**/
51
52# define AUX778076_SPEC_PARAMS(param) \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070053 NDNBOOST_MPL_PP_ENUM( \
54 NDNBOOST_PP_DEC(NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070055 , param \
56 ) \
57 /**/
58
59namespace aux {
60
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061#if !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
Jeff Thompsona28eed82013-08-22 16:21:10 -070062
63template< bool C_, AUX778076_PARAMS(typename T, 1) >
Jeff Thompson3d613fd2013-10-15 15:39:04 -070064struct NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)
65 : NDNBOOST_PP_CAT(AUX778076_OP_VALUE1,_)
Jeff Thompsona28eed82013-08-22 16:21:10 -070066{
67};
68
69template< AUX778076_PARAMS(typename T, 1) >
Jeff Thompson3d613fd2013-10-15 15:39:04 -070070struct NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)< AUX778076_OP_VALUE2,AUX778076_PARAMS(T, 1) >
71 : NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<
72 NDNBOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
Jeff Thompsona28eed82013-08-22 16:21:10 -070073 , AUX778076_SHIFTED_PARAMS(T, 1)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070074 , NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_)
Jeff Thompsona28eed82013-08-22 16:21:10 -070075 >
76{
77};
78
79template<>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070080struct NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<
Jeff Thompsona28eed82013-08-22 16:21:10 -070081 AUX778076_OP_VALUE2
Jeff Thompson3d613fd2013-10-15 15:39:04 -070082 , AUX778076_SPEC_PARAMS(NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_))
Jeff Thompsona28eed82013-08-22 16:21:10 -070083 >
Jeff Thompson3d613fd2013-10-15 15:39:04 -070084 : NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_)
Jeff Thompsona28eed82013-08-22 16:21:10 -070085{
86};
87
88#else
89
Jeff Thompson3d613fd2013-10-15 15:39:04 -070090template< bool C_ > struct NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)
Jeff Thompsona28eed82013-08-22 16:21:10 -070091{
92 template< AUX778076_PARAMS(typename T, 1) > struct result_
Jeff Thompson3d613fd2013-10-15 15:39:04 -070093 : NDNBOOST_PP_CAT(AUX778076_OP_VALUE1,_)
Jeff Thompsona28eed82013-08-22 16:21:10 -070094 {
95 };
96};
97
Jeff Thompson3d613fd2013-10-15 15:39:04 -070098template<> struct NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<AUX778076_OP_VALUE2>
Jeff Thompsona28eed82013-08-22 16:21:10 -070099{
100 template< AUX778076_PARAMS(typename T, 1) > struct result_
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700101 : NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<
102 NDNBOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
103 >::template result_< AUX778076_SHIFTED_PARAMS(T,1),NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_) >
Jeff Thompsona28eed82013-08-22 16:21:10 -0700104 {
105 };
106
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700107#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, == 1300)
108 template<> struct result_<AUX778076_SPEC_PARAMS(NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_))>
109 : NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700110 {
111 };
112};
113#else
114};
115
116template<>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700117struct NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<AUX778076_OP_VALUE2>
118 ::result_< AUX778076_SPEC_PARAMS(NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_)) >
119 : NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700120{
121};
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700122#endif // NDNBOOST_MSVC == 1300
Jeff Thompsona28eed82013-08-22 16:21:10 -0700123
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700124#endif // NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Jeff Thompsona28eed82013-08-22 16:21:10 -0700125
126} // namespace aux
127
128template<
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700129 typename NDNBOOST_MPL_AUX_NA_PARAM(T1)
130 , typename NDNBOOST_MPL_AUX_NA_PARAM(T2)
131 NDNBOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename T, NDNBOOST_PP_CAT(AUX778076_OP_VALUE2,_))
Jeff Thompsona28eed82013-08-22 16:21:10 -0700132 >
133struct AUX778076_OP_NAME
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700134#if !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
135 : aux::NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<
136 NDNBOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
Jeff Thompsona28eed82013-08-22 16:21:10 -0700137 , AUX778076_SHIFTED_PARAMS(T,0)
138 >
139#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700140 : aux::NDNBOOST_PP_CAT(AUX778076_OP_NAME,impl)<
141 NDNBOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
Jeff Thompsona28eed82013-08-22 16:21:10 -0700142 >::template result_< AUX778076_SHIFTED_PARAMS(T,0) >
143#endif
144{
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700145 NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(
146 NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY
Jeff Thompsona28eed82013-08-22 16:21:10 -0700147 , AUX778076_OP_NAME
148 , (AUX778076_PARAMS(T, 0))
149 )
150};
151
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700152NDNBOOST_MPL_AUX_NA_SPEC2(
Jeff Thompsona28eed82013-08-22 16:21:10 -0700153 2
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700154 , NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY
Jeff Thompsona28eed82013-08-22 16:21:10 -0700155 , 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