1 //-----------------------------------------------------------------------------
2 // boost mpl/arg.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
6 // Copyright (c) 2001-02
7 // Peter Dimov, Aleksey Gurtovoy
9 // Permission to use, copy, modify, distribute and sell this software
10 // and its documentation for any purpose is hereby granted without fee,
11 // provided that the above copyright notice appears in all copies and
12 // that both the copyright notice and this permission notice appear in
13 // supporting documentation. No representations are made about the
14 // suitability of this software for any purpose. It is provided "as is"
15 // without express or implied warranty.
17 #if !defined(BOOST_PP_IS_ITERATING)
21 #ifndef BOOST_MPL_ARG_HPP_INCLUDED
22 #define BOOST_MPL_ARG_HPP_INCLUDED
24 #include "boost/mpl/aux_/config/static_constant.hpp"
26 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
27 # include "boost/mpl/arg_fwd.hpp"
28 # include "boost/mpl/void.hpp"
29 # include "boost/mpl/aux_/arity_spec.hpp"
30 # include "boost/mpl/aux_/arg_typedef.hpp"
31 # include "boost/static_assert.hpp"
34 #include "boost/mpl/aux_/config/use_preprocessed.hpp"
36 #if !defined(BOOST_MPL_NO_PREPROCESSED_HEADERS) \
37 && !defined(BOOST_MPL_PREPROCESSING_MODE)
39 # define BOOST_MPL_PREPROCESSED_HEADER arg.hpp
40 # include "boost/mpl/aux_/include_preprocessed.hpp"
43 # include "boost/mpl/limits/arity.hpp"
44 # include "boost/mpl/aux_/preprocessor/default_params.hpp"
45 # include "boost/mpl/aux_/preprocessor/params.hpp"
46 # include "boost/mpl/aux_/config/lambda.hpp"
47 # include "boost/mpl/aux_/config/dtp.hpp"
48 # include "boost/mpl/aux_/config/nttp.hpp"
50 # include "boost/preprocessor/iterate.hpp"
51 # include "boost/preprocessor/inc.hpp"
52 # include "boost/preprocessor/cat.hpp"
57 // local macro, #undef-ined at the end of the header
58 #if !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES)
59 # define AUX_ARG_N_DEFAULT_PARAMS(param,value) \
60 BOOST_MPL_PP_DEFAULT_PARAMS( \
61 BOOST_MPL_METAFUNCTION_MAX_ARITY \
67 # define AUX_ARG_N_DEFAULT_PARAMS(param,value) \
68 BOOST_MPL_PP_PARAMS( \
69 BOOST_MPL_METAFUNCTION_MAX_ARITY \
75 #define BOOST_PP_ITERATION_PARAMS_1 \
76 (3,(0, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/arg.hpp"))
77 #include BOOST_PP_ITERATE()
80 # undef AUX_ARG_N_DEFAULT_PARAMS
82 BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int,arg)
87 #endif // BOOST_MPL_USE_PREPROCESSED_HEADERS
88 #endif // BOOST_MPL_ARG_HPP_INCLUDED
93 #define i BOOST_PP_FRAME_ITERATION(1)
97 template<> struct arg<i>
99 BOOST_STATIC_CONSTANT(int, value = i);
100 typedef arg<BOOST_PP_INC(i)> next;
101 BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag)
104 AUX_ARG_N_DEFAULT_PARAMS(typename U, void_)
108 typedef BOOST_PP_CAT(U,i) type;
109 #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x561 && defined(BOOST_STRICT_CONFIG))
111 BOOST_STATIC_CONSTANT(bool, nv = !is_void_<type>::value);
112 BOOST_STATIC_ASSERT(nv);
119 template<> struct arg<-1>
121 BOOST_STATIC_CONSTANT(int, value = -1);
122 BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag)
125 AUX_ARG_N_DEFAULT_PARAMS(typename U, void_)
130 #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x561 && defined(BOOST_STRICT_CONFIG))
132 BOOST_STATIC_CONSTANT(bool, nv = !is_void_<type>::value);
133 BOOST_STATIC_ASSERT(nv);
141 #endif // BOOST_PP_IS_ITERATING