blob: 6cd7721ca8d4c4b7a2d91d4f3ee08dea85c95524 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001
2#ifndef BOOST_MPL_AUX_NA_SPEC_HPP_INCLUDED
3#define BOOST_MPL_AUX_NA_SPEC_HPP_INCLUDED
4
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
17#if !defined(BOOST_MPL_PREPROCESSING_MODE)
18# include <boost/mpl/lambda_fwd.hpp>
19# include <boost/mpl/int.hpp>
20# include <boost/mpl/bool.hpp>
21# include <boost/mpl/aux_/na.hpp>
22# include <boost/mpl/aux_/arity.hpp>
23# include <boost/mpl/aux_/template_arity_fwd.hpp>
24#endif
25
26#include <boost/mpl/aux_/preprocessor/params.hpp>
27#include <boost/mpl/aux_/preprocessor/enum.hpp>
28#include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
29#include <boost/mpl/aux_/lambda_arity_param.hpp>
30#include <boost/mpl/aux_/config/dtp.hpp>
31#include <boost/mpl/aux_/config/eti.hpp>
32#include <boost/mpl/aux_/nttp_decl.hpp>
33#include <boost/mpl/aux_/config/ttp.hpp>
34#include <boost/mpl/aux_/config/lambda.hpp>
35#include <boost/mpl/aux_/config/overload_resolution.hpp>
36
37
38#define BOOST_MPL_AUX_NA_PARAMS(i) \
39 BOOST_MPL_PP_ENUM(i, na) \
40/**/
41
42#if defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
43# define BOOST_MPL_AUX_NA_SPEC_ARITY(i, name) \
44namespace aux { \
45template< BOOST_MPL_AUX_NTTP_DECL(int, N) > \
46struct arity< \
47 name< BOOST_MPL_AUX_NA_PARAMS(i) > \
48 , N \
49 > \
50 : int_< BOOST_MPL_LIMIT_METAFUNCTION_ARITY > \
51{ \
52}; \
53} \
54/**/
55#else
56# define BOOST_MPL_AUX_NA_SPEC_ARITY(i, name) /**/
57#endif
58
59#define BOOST_MPL_AUX_NA_SPEC_MAIN(i, name) \
60template<> \
61struct name< BOOST_MPL_AUX_NA_PARAMS(i) > \
62{ \
63 template< \
64 BOOST_MPL_PP_PARAMS(i, typename T) \
65 BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, typename T, na) \
66 > \
67 struct apply \
68 : name< BOOST_MPL_PP_PARAMS(i, T) > \
69 { \
70 }; \
71}; \
72/**/
73
74#if defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
75# define BOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
76template<> \
77struct lambda< \
78 name< BOOST_MPL_AUX_NA_PARAMS(i) > \
79 , void_ \
80 , true_ \
81 > \
82{ \
83 typedef false_ is_le; \
84 typedef name< BOOST_MPL_AUX_NA_PARAMS(i) > type; \
85}; \
86template<> \
87struct lambda< \
88 name< BOOST_MPL_AUX_NA_PARAMS(i) > \
89 , void_ \
90 , false_ \
91 > \
92{ \
93 typedef false_ is_le; \
94 typedef name< BOOST_MPL_AUX_NA_PARAMS(i) > type; \
95}; \
96/**/
97#else
98# define BOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
99template< typename Tag > \
100struct lambda< \
101 name< BOOST_MPL_AUX_NA_PARAMS(i) > \
102 , Tag \
103 BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(int_<-1>) \
104 > \
105{ \
106 typedef false_ is_le; \
107 typedef name< BOOST_MPL_AUX_NA_PARAMS(i) > result_; \
108 typedef name< BOOST_MPL_AUX_NA_PARAMS(i) > type; \
109}; \
110/**/
111#endif
112
113#if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) \
114 || defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) \
115 && defined(BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION)
116# define BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, j, name) \
117namespace aux { \
118template< BOOST_MPL_PP_PARAMS(j, typename T) > \
119struct template_arity< \
120 name< BOOST_MPL_PP_PARAMS(j, T) > \
121 > \
122 : int_<j> \
123{ \
124}; \
125\
126template<> \
127struct template_arity< \
128 name< BOOST_MPL_PP_ENUM(i, na) > \
129 > \
130 : int_<-1> \
131{ \
132}; \
133} \
134/**/
135#else
136# define BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, j, name) /**/
137#endif
138
139#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
140# define BOOST_MPL_AUX_NA_SPEC_ETI(i, name) \
141template<> \
142struct name< BOOST_MPL_PP_ENUM(i, int) > \
143{ \
144 typedef int type; \
145 enum { value = 0 }; \
146}; \
147/**/
148#else
149# define BOOST_MPL_AUX_NA_SPEC_ETI(i, name) /**/
150#endif
151
152#define BOOST_MPL_AUX_NA_PARAM(param) param = na
153
154#define BOOST_MPL_AUX_NA_SPEC_NO_ETI(i, name) \
155BOOST_MPL_AUX_NA_SPEC_MAIN(i, name) \
156BOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
157BOOST_MPL_AUX_NA_SPEC_ARITY(i, name) \
158BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, i, name) \
159/**/
160
161#define BOOST_MPL_AUX_NA_SPEC(i, name) \
162BOOST_MPL_AUX_NA_SPEC_NO_ETI(i, name) \
163BOOST_MPL_AUX_NA_SPEC_ETI(i, name) \
164/**/
165
166#define BOOST_MPL_AUX_NA_SPEC2(i, j, name) \
167BOOST_MPL_AUX_NA_SPEC_MAIN(i, name) \
168BOOST_MPL_AUX_NA_SPEC_ETI(i, name) \
169BOOST_MPL_AUX_NA_SPEC_LAMBDA(i, name) \
170BOOST_MPL_AUX_NA_SPEC_ARITY(i, name) \
171BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(i, j, name) \
172/**/
173
174
175#endif // BOOST_MPL_AUX_NA_SPEC_HPP_INCLUDED