blob: ed03f4c261def26b1dbe1509efc6b27a9e5bfd56 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001
Jeff Thompson3d613fd2013-10-15 15:39:04 -07002#ifndef NDNBOOST_MPL_AUX_NA_SPEC_HPP_INCLUDED
3#define NDNBOOST_MPL_AUX_NA_SPEC_HPP_INCLUDED
Jeff Thompsonf7d49942013-08-01 16:47:40 -07004
5// Copyright Aleksey Gurtovoy 2001-2004
6//
7// Distributed under the Boost Software License, Version 1.0.
8// (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// See http://www.boost.org/libs/mpl for documentation.
12
13// $Id: na_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $
15// $Revision: 49267 $
16
Jeff Thompson3d613fd2013-10-15 15:39:04 -070017#if !defined(NDNBOOST_MPL_PREPROCESSING_MODE)
Jeff Thompson2277ce52013-08-01 17:34:11 -070018# include <ndnboost/mpl/lambda_fwd.hpp>
19# include <ndnboost/mpl/int.hpp>
20# include <ndnboost/mpl/bool.hpp>
21# include <ndnboost/mpl/aux_/na.hpp>
22# include <ndnboost/mpl/aux_/arity.hpp>
23# include <ndnboost/mpl/aux_/template_arity_fwd.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070024#endif
25
Jeff Thompson2277ce52013-08-01 17:34:11 -070026#include <ndnboost/mpl/aux_/preprocessor/params.hpp>
27#include <ndnboost/mpl/aux_/preprocessor/enum.hpp>
28#include <ndnboost/mpl/aux_/preprocessor/def_params_tail.hpp>
29#include <ndnboost/mpl/aux_/lambda_arity_param.hpp>
30#include <ndnboost/mpl/aux_/config/dtp.hpp>
31#include <ndnboost/mpl/aux_/config/eti.hpp>
32#include <ndnboost/mpl/aux_/nttp_decl.hpp>
33#include <ndnboost/mpl/aux_/config/ttp.hpp>
34#include <ndnboost/mpl/aux_/config/lambda.hpp>
35#include <ndnboost/mpl/aux_/config/overload_resolution.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070036
37
Jeff Thompson3d613fd2013-10-15 15:39:04 -070038#define NDNBOOST_MPL_AUX_NA_PARAMS(i) \
39 NDNBOOST_MPL_PP_ENUM(i, na) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070040/**/
41
Jeff Thompson3d613fd2013-10-15 15:39:04 -070042#if defined(NDNBOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
43# define NDNBOOST_MPL_AUX_NA_SPEC_ARITY(i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070044namespace aux { \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045template< NDNBOOST_MPL_AUX_NTTP_DECL(int, N) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070046struct arity< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070047 name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070048 , N \
49 > \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070050 : int_< NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070051{ \
52}; \
53} \
54/**/
55#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070056# define NDNBOOST_MPL_AUX_NA_SPEC_ARITY(i, name) /**/
Jeff Thompsonf7d49942013-08-01 16:47:40 -070057#endif
58
Jeff Thompson3d613fd2013-10-15 15:39:04 -070059#define NDNBOOST_MPL_AUX_NA_SPEC_MAIN(i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070060template<> \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061struct name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070062{ \
63 template< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070064 NDNBOOST_MPL_PP_PARAMS(i, typename T) \
65 NDNBOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, typename T, na) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070066 > \
67 struct apply \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070068 : name< NDNBOOST_MPL_PP_PARAMS(i, T) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070069 { \
70 }; \
71}; \
72/**/
73
Jeff Thompson3d613fd2013-10-15 15:39:04 -070074#if defined(NDNBOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
75# define NDNBOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070076template<> \
77struct lambda< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070078 name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070079 , void_ \
80 , true_ \
81 > \
82{ \
83 typedef false_ is_le; \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070084 typedef name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > type; \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070085}; \
86template<> \
87struct lambda< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070088 name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070089 , void_ \
90 , false_ \
91 > \
92{ \
93 typedef false_ is_le; \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070094 typedef name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > type; \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070095}; \
96/**/
97#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070098# define NDNBOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070099template< typename Tag > \
100struct lambda< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700101 name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700102 , Tag \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700103 NDNBOOST_MPL_AUX_LAMBDA_ARITY_PARAM(int_<-1>) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700104 > \
105{ \
106 typedef false_ is_le; \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700107 typedef name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > result_; \
108 typedef name< NDNBOOST_MPL_AUX_NA_PARAMS(i) > type; \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700109}; \
110/**/
111#endif
112
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700113#if defined(NDNBOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) \
114 || defined(NDNBOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) \
115 && defined(NDNBOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION)
116# define NDNBOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, j, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700117namespace aux { \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700118template< NDNBOOST_MPL_PP_PARAMS(j, typename T) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700119struct template_arity< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700120 name< NDNBOOST_MPL_PP_PARAMS(j, T) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700121 > \
122 : int_<j> \
123{ \
124}; \
125\
126template<> \
127struct template_arity< \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700128 name< NDNBOOST_MPL_PP_ENUM(i, na) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700129 > \
130 : int_<-1> \
131{ \
132}; \
133} \
134/**/
135#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700136# define NDNBOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, j, name) /**/
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700137#endif
138
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700139#if defined(NDNBOOST_MPL_CFG_MSVC_ETI_BUG)
140# define NDNBOOST_MPL_AUX_NA_SPEC_ETI(i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700141template<> \
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700142struct name< NDNBOOST_MPL_PP_ENUM(i, int) > \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700143{ \
144 typedef int type; \
145 enum { value = 0 }; \
146}; \
147/**/
148#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700149# define NDNBOOST_MPL_AUX_NA_SPEC_ETI(i, name) /**/
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700150#endif
151
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700152#define NDNBOOST_MPL_AUX_NA_PARAM(param) param = na
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700153
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700154#define NDNBOOST_MPL_AUX_NA_SPEC_NO_ETI(i, name) \
155NDNBOOST_MPL_AUX_NA_SPEC_MAIN(i, name) \
156NDNBOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
157NDNBOOST_MPL_AUX_NA_SPEC_ARITY(i, name) \
158NDNBOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700159/**/
160
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700161#define NDNBOOST_MPL_AUX_NA_SPEC(i, name) \
162NDNBOOST_MPL_AUX_NA_SPEC_NO_ETI(i, name) \
163NDNBOOST_MPL_AUX_NA_SPEC_ETI(i, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700164/**/
165
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700166#define NDNBOOST_MPL_AUX_NA_SPEC2(i, j, name) \
167NDNBOOST_MPL_AUX_NA_SPEC_MAIN(i, name) \
168NDNBOOST_MPL_AUX_NA_SPEC_ETI(i, name) \
169NDNBOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
170NDNBOOST_MPL_AUX_NA_SPEC_ARITY(i, name) \
171NDNBOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, j, name) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700172/**/
173
174
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700175#endif // NDNBOOST_MPL_AUX_NA_SPEC_HPP_INCLUDED