2 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
\r
4 // Copyright Aleksey Gurtovoy 2000-2004
\r
6 // Distributed under the Boost Software License, Version 1.0.
\r
7 // (See accompanying file LICENSE_1_0.txt or copy at
\r
8 // http://www.boost.org/LICENSE_1_0.txt)
\r
10 // See http://www.boost.org/libs/mpl for documentation.
\r
12 // $Id: count_args.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
13 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
14 // $Revision: 49267 $
\r
16 #include <boost/preprocessor/expr_if.hpp>
\r
17 #include <boost/preprocessor/inc.hpp>
\r
18 #include <boost/preprocessor/cat.hpp>
\r
20 #if !defined(AUX778076_COUNT_ARGS_PARAM_NAME)
\r
21 # define AUX778076_COUNT_ARGS_PARAM_NAME T
\r
24 #if !defined(AUX778076_COUNT_ARGS_TEMPLATE_PARAM)
\r
25 # define AUX778076_COUNT_ARGS_TEMPLATE_PARAM typename AUX778076_COUNT_ARGS_PARAM_NAME
\r
28 // local macros, #undef-ined at the end of the header
\r
30 #if !defined(AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES)
\r
32 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
\r
33 # include <boost/mpl/aux_/preprocessor/params.hpp>
\r
35 # define AUX778076_COUNT_ARGS_REPEAT BOOST_MPL_PP_REPEAT
\r
36 # define AUX778076_COUNT_ARGS_PARAMS(param) \
\r
37 BOOST_MPL_PP_PARAMS( \
\r
38 AUX778076_COUNT_ARGS_ARITY \
\r
45 # include <boost/preprocessor/enum_shifted_params.hpp>
\r
46 # include <boost/preprocessor/repeat.hpp>
\r
47 # include <boost/preprocessor/inc.hpp>
\r
49 # define AUX778076_COUNT_ARGS_REPEAT BOOST_PP_REPEAT
\r
50 # define AUX778076_COUNT_ARGS_PARAMS(param) \
\r
51 BOOST_PP_ENUM_SHIFTED_PARAMS( \
\r
52 BOOST_PP_INC(AUX778076_COUNT_ARGS_ARITY) \
\r
57 #endif // AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES
\r
60 #define AUX778076_IS_ARG_TEMPLATE_NAME \
\r
61 BOOST_PP_CAT(is_,BOOST_PP_CAT(AUX778076_COUNT_ARGS_PREFIX,_arg)) \
\r
64 #define AUX778076_COUNT_ARGS_FUNC(unused, i, param) \
\r
65 BOOST_PP_EXPR_IF(i, +) \
\r
66 AUX778076_IS_ARG_TEMPLATE_NAME<BOOST_PP_CAT(param,BOOST_PP_INC(i))>::value \
\r
70 template< AUX778076_COUNT_ARGS_TEMPLATE_PARAM >
\r
71 struct AUX778076_IS_ARG_TEMPLATE_NAME
\r
73 BOOST_STATIC_CONSTANT(bool, value = true);
\r
77 struct AUX778076_IS_ARG_TEMPLATE_NAME<AUX778076_COUNT_ARGS_DEFAULT>
\r
79 BOOST_STATIC_CONSTANT(bool, value = false);
\r
84 AUX778076_COUNT_ARGS_PARAMS(AUX778076_COUNT_ARGS_TEMPLATE_PARAM)
\r
86 struct BOOST_PP_CAT(AUX778076_COUNT_ARGS_PREFIX,_count_args)
\r
88 BOOST_STATIC_CONSTANT(int, value = AUX778076_COUNT_ARGS_REPEAT(
\r
89 AUX778076_COUNT_ARGS_ARITY
\r
90 , AUX778076_COUNT_ARGS_FUNC
\r
91 , AUX778076_COUNT_ARGS_PARAM_NAME
\r
95 #undef AUX778076_COUNT_ARGS_FUNC
\r
96 #undef AUX778076_IS_ARG_TEMPLATE_NAME
\r
97 #undef AUX778076_COUNT_ARGS_PARAMS
\r
98 #undef AUX778076_COUNT_ARGS_REPEAT
\r
100 #undef AUX778076_COUNT_ARGS_ARITY
\r
101 #undef AUX778076_COUNT_ARGS_DEFAULT
\r
102 #undef AUX778076_COUNT_ARGS_PREFIX
\r
103 #undef AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES
\r
104 #undef AUX778076_COUNT_ARGS_TEMPLATE_PARAM
\r
105 #undef AUX778076_COUNT_ARGS_PARAM_NAME
\r