1 |
|
---|
2 | // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
|
---|
3 |
|
---|
4 | // Copyright Aleksey Gurtovoy 2000-2004
|
---|
5 | //
|
---|
6 | // Distributed under the Boost Software License, Version 1.0.
|
---|
7 | // (See accompanying file LICENSE_1_0.txt or copy at
|
---|
8 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
9 | //
|
---|
10 | // See http://www.boost.org/libs/mpl for documentation.
|
---|
11 |
|
---|
12 | // $Source: /cvsroot/boost/boost/boost/mpl/aux_/count_args.hpp,v $
|
---|
13 | // $Date: 2004/09/02 15:40:43 $
|
---|
14 | // $Revision: 1.5 $
|
---|
15 |
|
---|
16 | #include <boost/preprocessor/expr_if.hpp>
|
---|
17 | #include <boost/preprocessor/inc.hpp>
|
---|
18 | #include <boost/preprocessor/cat.hpp>
|
---|
19 |
|
---|
20 | #if !defined(AUX778076_COUNT_ARGS_PARAM_NAME)
|
---|
21 | # define AUX778076_COUNT_ARGS_PARAM_NAME T
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #if !defined(AUX778076_COUNT_ARGS_TEMPLATE_PARAM)
|
---|
25 | # define AUX778076_COUNT_ARGS_TEMPLATE_PARAM typename AUX778076_COUNT_ARGS_PARAM_NAME
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | // local macros, #undef-ined at the end of the header
|
---|
29 |
|
---|
30 | #if !defined(AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES)
|
---|
31 |
|
---|
32 | # include <boost/mpl/aux_/preprocessor/repeat.hpp>
|
---|
33 | # include <boost/mpl/aux_/preprocessor/params.hpp>
|
---|
34 |
|
---|
35 | # define AUX778076_COUNT_ARGS_REPEAT BOOST_MPL_PP_REPEAT
|
---|
36 | # define AUX778076_COUNT_ARGS_PARAMS(param) \
|
---|
37 | BOOST_MPL_PP_PARAMS( \
|
---|
38 | AUX778076_COUNT_ARGS_ARITY \
|
---|
39 | , param \
|
---|
40 | ) \
|
---|
41 | /**/
|
---|
42 |
|
---|
43 | #else
|
---|
44 |
|
---|
45 | # include <boost/preprocessor/enum_shifted_params.hpp>
|
---|
46 | # include <boost/preprocessor/repeat.hpp>
|
---|
47 | # include <boost/preprocessor/inc.hpp>
|
---|
48 |
|
---|
49 | # define AUX778076_COUNT_ARGS_REPEAT BOOST_PP_REPEAT
|
---|
50 | # define AUX778076_COUNT_ARGS_PARAMS(param) \
|
---|
51 | BOOST_PP_ENUM_SHIFTED_PARAMS( \
|
---|
52 | BOOST_PP_INC(AUX778076_COUNT_ARGS_ARITY) \
|
---|
53 | , param \
|
---|
54 | ) \
|
---|
55 | /**/
|
---|
56 |
|
---|
57 | #endif // AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES
|
---|
58 |
|
---|
59 |
|
---|
60 | #define AUX778076_IS_ARG_TEMPLATE_NAME \
|
---|
61 | BOOST_PP_CAT(is_,BOOST_PP_CAT(AUX778076_COUNT_ARGS_PREFIX,_arg)) \
|
---|
62 | /**/
|
---|
63 |
|
---|
64 | #define AUX778076_COUNT_ARGS_FUNC(unused, i, param) \
|
---|
65 | BOOST_PP_EXPR_IF(i, +) \
|
---|
66 | AUX778076_IS_ARG_TEMPLATE_NAME<BOOST_PP_CAT(param,BOOST_PP_INC(i))>::value \
|
---|
67 | /**/
|
---|
68 |
|
---|
69 | // is_<xxx>_arg
|
---|
70 | template< AUX778076_COUNT_ARGS_TEMPLATE_PARAM >
|
---|
71 | struct AUX778076_IS_ARG_TEMPLATE_NAME
|
---|
72 | {
|
---|
73 | BOOST_STATIC_CONSTANT(bool, value = true);
|
---|
74 | };
|
---|
75 |
|
---|
76 | template<>
|
---|
77 | struct AUX778076_IS_ARG_TEMPLATE_NAME<AUX778076_COUNT_ARGS_DEFAULT>
|
---|
78 | {
|
---|
79 | BOOST_STATIC_CONSTANT(bool, value = false);
|
---|
80 | };
|
---|
81 |
|
---|
82 | // <xxx>_count_args
|
---|
83 | template<
|
---|
84 | AUX778076_COUNT_ARGS_PARAMS(AUX778076_COUNT_ARGS_TEMPLATE_PARAM)
|
---|
85 | >
|
---|
86 | struct BOOST_PP_CAT(AUX778076_COUNT_ARGS_PREFIX,_count_args)
|
---|
87 | {
|
---|
88 | BOOST_STATIC_CONSTANT(int, value = AUX778076_COUNT_ARGS_REPEAT(
|
---|
89 | AUX778076_COUNT_ARGS_ARITY
|
---|
90 | , AUX778076_COUNT_ARGS_FUNC
|
---|
91 | , AUX778076_COUNT_ARGS_PARAM_NAME
|
---|
92 | ));
|
---|
93 | };
|
---|
94 |
|
---|
95 | #undef AUX778076_COUNT_ARGS_FUNC
|
---|
96 | #undef AUX778076_IS_ARG_TEMPLATE_NAME
|
---|
97 | #undef AUX778076_COUNT_ARGS_PARAMS
|
---|
98 | #undef AUX778076_COUNT_ARGS_REPEAT
|
---|
99 |
|
---|
100 | #undef AUX778076_COUNT_ARGS_ARITY
|
---|
101 | #undef AUX778076_COUNT_ARGS_DEFAULT
|
---|
102 | #undef AUX778076_COUNT_ARGS_PREFIX
|
---|
103 | #undef AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES
|
---|
104 | #undef AUX778076_COUNT_ARGS_TEMPLATE_PARAM
|
---|
105 | #undef AUX778076_COUNT_ARGS_PARAM_NAME
|
---|