1 | |
---|
2 | #if !defined(BOOST_PP_IS_ITERATING) |
---|
3 | |
---|
4 | ///// header body |
---|
5 | |
---|
6 | #ifndef BOOST_MPL_UNPACK_ARGS_HPP_INCLUDED |
---|
7 | #define BOOST_MPL_UNPACK_ARGS_HPP_INCLUDED |
---|
8 | |
---|
9 | // Copyright Aleksey Gurtovoy 2002-2004 |
---|
10 | // |
---|
11 | // Distributed under the Boost Software License, Version 1.0. |
---|
12 | // (See accompanying file LICENSE_1_0.txt or copy at |
---|
13 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
14 | // |
---|
15 | // See http://www.boost.org/libs/mpl for documentation. |
---|
16 | |
---|
17 | // $Id: unpack_args.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ |
---|
18 | // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ |
---|
19 | // $Revision: 49267 $ |
---|
20 | |
---|
21 | #if !defined(BOOST_MPL_PREPROCESSING_MODE) |
---|
22 | # include <boost/mpl/apply.hpp> |
---|
23 | # include <boost/mpl/at.hpp> |
---|
24 | # include <boost/mpl/size.hpp> |
---|
25 | # include <boost/mpl/aux_/nttp_decl.hpp> |
---|
26 | # include <boost/mpl/aux_/lambda_spec.hpp> |
---|
27 | #endif |
---|
28 | |
---|
29 | #include <boost/mpl/aux_/config/use_preprocessed.hpp> |
---|
30 | |
---|
31 | #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ |
---|
32 | && !defined(BOOST_MPL_PREPROCESSING_MODE) |
---|
33 | |
---|
34 | # define BOOST_MPL_PREPROCESSED_HEADER unpack_args.hpp |
---|
35 | # include <boost/mpl/aux_/include_preprocessed.hpp> |
---|
36 | |
---|
37 | #else |
---|
38 | |
---|
39 | # include <boost/mpl/limits/arity.hpp> |
---|
40 | # include <boost/mpl/aux_/preprocessor/repeat.hpp> |
---|
41 | # include <boost/mpl/aux_/config/ctps.hpp> |
---|
42 | # include <boost/mpl/aux_/config/forwarding.hpp> |
---|
43 | # include <boost/preprocessor/iterate.hpp> |
---|
44 | # include <boost/preprocessor/cat.hpp> |
---|
45 | |
---|
46 | |
---|
47 | namespace boost { namespace mpl { |
---|
48 | |
---|
49 | // local macros, #undef-ined at the end of the header |
---|
50 | |
---|
51 | # define AUX778076_UNPACK(unused, i, Args) \ |
---|
52 | , typename at_c<Args,i>::type \ |
---|
53 | /**/ |
---|
54 | |
---|
55 | # define AUX778076_UNPACKED_ARGS(n, Args) \ |
---|
56 | BOOST_MPL_PP_REPEAT(n, AUX778076_UNPACK, Args) \ |
---|
57 | /**/ |
---|
58 | |
---|
59 | namespace aux { |
---|
60 | |
---|
61 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
62 | template< int size, typename F, typename Args > |
---|
63 | struct unpack_args_impl; |
---|
64 | #else |
---|
65 | template< BOOST_MPL_AUX_NTTP_DECL(int, size) > struct unpack_args_impl |
---|
66 | { |
---|
67 | template< typename F, typename Args > struct apply; |
---|
68 | }; |
---|
69 | #endif |
---|
70 | |
---|
71 | #define BOOST_PP_ITERATION_PARAMS_1 \ |
---|
72 | (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/unpack_args.hpp>)) |
---|
73 | #include BOOST_PP_ITERATE() |
---|
74 | |
---|
75 | } |
---|
76 | |
---|
77 | template< |
---|
78 | typename F |
---|
79 | > |
---|
80 | struct unpack_args |
---|
81 | { |
---|
82 | template< typename Args > struct apply |
---|
83 | #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) |
---|
84 | # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
85 | : aux::unpack_args_impl< size<Args>::value,F,Args > |
---|
86 | # else |
---|
87 | : aux::unpack_args_impl< size<Args>::value > |
---|
88 | ::template apply< F,Args > |
---|
89 | # endif |
---|
90 | { |
---|
91 | #else // BOOST_MPL_CFG_NO_NESTED_FORWARDING |
---|
92 | { |
---|
93 | typedef typename aux::unpack_args_impl< |
---|
94 | size<Args>::value |
---|
95 | , F |
---|
96 | , Args |
---|
97 | >::type type; |
---|
98 | #endif |
---|
99 | }; |
---|
100 | }; |
---|
101 | |
---|
102 | BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(1, unpack_args) |
---|
103 | |
---|
104 | # undef AUX778076_UNPACK |
---|
105 | # undef AUX778076_UNPACKED_ARGS |
---|
106 | |
---|
107 | }} |
---|
108 | |
---|
109 | #endif // BOOST_MPL_CFG_USE_PREPROCESSED_HEADERS |
---|
110 | #endif // BOOST_MPL_UNPACK_ARGS_HPP_INCLUDED |
---|
111 | |
---|
112 | ///// iteration, depth == 1 |
---|
113 | |
---|
114 | // For gcc 4.4 compatability, we must include the |
---|
115 | // BOOST_PP_ITERATION_DEPTH test inside an #else clause. |
---|
116 | #else // BOOST_PP_IS_ITERATING |
---|
117 | #if BOOST_PP_ITERATION_DEPTH() == 1 |
---|
118 | |
---|
119 | # define i_ BOOST_PP_FRAME_ITERATION(1) |
---|
120 | |
---|
121 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
---|
122 | |
---|
123 | template< typename F, typename Args > |
---|
124 | struct unpack_args_impl<i_,F,Args> |
---|
125 | : BOOST_PP_CAT(apply,i_)< |
---|
126 | F |
---|
127 | AUX778076_UNPACKED_ARGS(i_, Args) |
---|
128 | > |
---|
129 | { |
---|
130 | }; |
---|
131 | |
---|
132 | #else |
---|
133 | |
---|
134 | template<> struct unpack_args_impl<i_> |
---|
135 | { |
---|
136 | template< typename F, typename Args > struct apply |
---|
137 | : BOOST_PP_CAT(apply,i_)< |
---|
138 | F |
---|
139 | AUX778076_UNPACKED_ARGS(i_, Args) |
---|
140 | > |
---|
141 | { |
---|
142 | }; |
---|
143 | }; |
---|
144 | |
---|
145 | #endif |
---|
146 | |
---|
147 | # undef i_ |
---|
148 | |
---|
149 | #endif // BOOST_PP_ITERATION_DEPTH() |
---|
150 | #endif // BOOST_PP_IS_ITERATING |
---|