source: NonGTP/Boost/boost/mpl/unpack_args.hpp @ 857

Revision 857, 3.5 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]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// $Source: /cvsroot/boost/boost/boost/mpl/unpack_args.hpp,v $
18// $Date: 2004/09/02 15:40:42 $
19// $Revision: 1.2 $
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
47namespace 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
59namespace aux {
60
61#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
62template< int size, typename F, typename Args >
63struct unpack_args_impl;
64#else
65template< 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
77template<
78      typename F
79    >
80struct 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
102BOOST_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#elif BOOST_PP_ITERATION_DEPTH() == 1
115
116#   define i_ BOOST_PP_FRAME_ITERATION(1)
117
118#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
119
120template< typename F, typename Args >
121struct unpack_args_impl<i_,F,Args>
122    : BOOST_PP_CAT(apply,i_)<
123          F
124        AUX778076_UNPACKED_ARGS(i_, Args)
125        >
126{
127};
128
129#else
130
131template<> struct unpack_args_impl<i_>
132{
133    template< typename F, typename Args > struct apply
134        : BOOST_PP_CAT(apply,i_)<
135              F
136            AUX778076_UNPACKED_ARGS(i_, Args)
137            >
138    {
139    };
140};
141
142#endif
143
144#   undef i_
145
146#endif // BOOST_PP_IS_ITERATING
Note: See TracBrowser for help on using the repository browser.