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