1 | |
2 | #ifndef BOOST_MPL_AUX_PREPROCESSOR_DEF_PARAMS_TAIL_HPP_INCLUDED |
3 | #define BOOST_MPL_AUX_PREPROCESSOR_DEF_PARAMS_TAIL_HPP_INCLUDED |
4 | |
5 | // Copyright Aleksey Gurtovoy 2000-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$ |
14 | // $Date$ |
15 | // $Revision$ |
16 | |
17 | #include <boost/mpl/limits/arity.hpp> |
18 | #include <boost/mpl/aux_/config/dtp.hpp> |
19 | #include <boost/mpl/aux_/config/preprocessor.hpp> |
20 | |
21 | #include <boost/preprocessor/comma_if.hpp> |
22 | #include <boost/preprocessor/logical/and.hpp> |
23 | #include <boost/preprocessor/identity.hpp> |
24 | #include <boost/preprocessor/empty.hpp> |
25 | |
26 | // BOOST_MPL_PP_DEF_PARAMS_TAIL(1,T,value): , T1 = value, .., Tn = value |
27 | // BOOST_MPL_PP_DEF_PARAMS_TAIL(2,T,value): , T2 = value, .., Tn = value |
28 | // BOOST_MPL_PP_DEF_PARAMS_TAIL(n,T,value): <nothing> |
29 | |
30 | #if !defined(BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES) |
31 | |
32 | # include <boost/mpl/aux_/preprocessor/filter_params.hpp> |
33 | # include <boost/mpl/aux_/preprocessor/sub.hpp> |
34 | |
35 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, value_func) \ |
36 | BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_1( \ |
37 | i \ |
38 | , BOOST_MPL_PP_SUB(BOOST_MPL_LIMIT_METAFUNCTION_ARITY,i) \ |
39 | , param \ |
40 | , value_func \ |
41 | ) \ |
42 | /**/ |
43 | |
44 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_1(i, n, param, value_func) \ |
45 | BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_2(i,n,param,value_func) \ |
46 | /**/ |
47 | |
48 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_2(i, n, param, value_func) \ |
49 | BOOST_PP_COMMA_IF(BOOST_PP_AND(i,n)) \ |
50 | BOOST_MPL_PP_DEF_PARAMS_TAIL_##i(n,param,value_func) \ |
51 | /**/ |
52 | |
53 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_0(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##1 v(),p##2 v(),p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v()) |
54 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_1(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##2 v(),p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1) |
55 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_2(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2) |
56 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_3(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3) |
57 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_4(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3,p4) |
58 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_5(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3,p4,p5) |
59 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_6(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##7 v(),p##8 v(),p##9 v(),p1,p2,p3,p4,p5,p6) |
60 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_7(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##8 v(),p##9 v(),p1,p2,p3,p4,p5,p6,p7) |
61 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_8(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##9 v(),p1,p2,p3,p4,p5,p6,p7,p8) |
62 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_9(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p1,p2,p3,p4,p5,p6,p7,p8,p9) |
63 | |
64 | #else |
65 | |
66 | # include <boost/preprocessor/arithmetic/add.hpp> |
67 | # include <boost/preprocessor/arithmetic/sub.hpp> |
68 | # include <boost/preprocessor/inc.hpp> |
69 | # include <boost/preprocessor/tuple/elem.hpp> |
70 | # include <boost/preprocessor/repeat.hpp> |
71 | # include <boost/preprocessor/cat.hpp> |
72 | |
73 | # define BOOST_MPL_PP_AUX_TAIL_PARAM_FUNC(unused, i, op) \ |
74 | , BOOST_PP_CAT( \ |
75 | BOOST_PP_TUPLE_ELEM(3, 1, op) \ |
76 | , BOOST_PP_ADD_D(1, i, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(3, 0, op))) \ |
77 | ) BOOST_PP_TUPLE_ELEM(3, 2, op)() \ |
78 | /**/ |
79 | |
80 | # define BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, value_func) \ |
81 | BOOST_PP_REPEAT( \ |
82 | BOOST_PP_SUB_D(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, i) \ |
83 | , BOOST_MPL_PP_AUX_TAIL_PARAM_FUNC \ |
84 | , (i, param, value_func) \ |
85 | ) \ |
86 | /**/ |
87 | |
88 | |
89 | #endif // BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES |
90 | |
91 | #define BOOST_MPL_PP_DEF_PARAMS_TAIL(i, param, value) \ |
92 | BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, BOOST_PP_IDENTITY(=value)) \ |
93 | /**/ |
94 | |
95 | #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) |
96 | # define BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, param, value) \ |
97 | BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, BOOST_PP_IDENTITY(=value)) \ |
98 | /**/ |
99 | #else |
100 | # define BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, param, value) \ |
101 | BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, BOOST_PP_EMPTY) \ |
102 | /**/ |
103 | #endif |
104 | |
105 | #endif // BOOST_MPL_AUX_PREPROCESSOR_DEF_PARAMS_TAIL_HPP_INCLUDED |
106 | |