PageRenderTime 29ms CodeModel.GetById 2ms app.highlight 20ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/mpl/apply.hpp

http://hadesmem.googlecode.com/
C++ Header | 229 lines | 160 code | 44 blank | 25 comment | 8 complexity | 3ccaf3e9fb2589f6d0a6561dec4f20e8 MD5 | raw file
  1
  2#if !defined(BOOST_PP_IS_ITERATING)
  3
  4///// header body
  5
  6#ifndef BOOST_MPL_APPLY_HPP_INCLUDED
  7#define BOOST_MPL_APPLY_HPP_INCLUDED
  8
  9// Copyright Aleksey Gurtovoy 2000-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: apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
 18// $Date: 2008-10-11 17:19:02 +1100 (Sat, 11 Oct 2008) $
 19// $Revision: 49267 $
 20
 21#if !defined(BOOST_MPL_PREPROCESSING_MODE)
 22#   include <boost/mpl/apply_fwd.hpp>
 23#   include <boost/mpl/apply_wrap.hpp>
 24#   include <boost/mpl/placeholders.hpp>
 25#   include <boost/mpl/lambda.hpp>
 26#   include <boost/mpl/aux_/na.hpp>
 27#   include <boost/mpl/aux_/lambda_support.hpp>
 28#endif
 29
 30#include <boost/mpl/aux_/config/use_preprocessed.hpp>
 31
 32#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
 33    && !defined(BOOST_MPL_PREPROCESSING_MODE)
 34
 35#   define BOOST_MPL_PREPROCESSED_HEADER apply.hpp
 36#   include <boost/mpl/aux_/include_preprocessed.hpp>
 37
 38#else
 39
 40#   include <boost/mpl/limits/arity.hpp>
 41#   include <boost/mpl/aux_/preprocessor/params.hpp>
 42#   include <boost/mpl/aux_/preprocessor/default_params.hpp>
 43#   include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
 44#   include <boost/mpl/aux_/preprocessor/enum.hpp>
 45#   include <boost/mpl/aux_/config/lambda.hpp>
 46#   include <boost/mpl/aux_/config/dtp.hpp>
 47#   include <boost/mpl/aux_/nttp_decl.hpp>
 48#   include <boost/mpl/aux_/config/eti.hpp>
 49#   include <boost/mpl/aux_/config/msvc.hpp>
 50#   include <boost/mpl/aux_/config/workaround.hpp>
 51
 52#   include <boost/preprocessor/comma_if.hpp>
 53#   include <boost/preprocessor/inc.hpp>
 54#   include <boost/preprocessor/iterate.hpp>
 55#   include <boost/preprocessor/cat.hpp>
 56
 57namespace boost { namespace mpl {
 58
 59// local macros, #undef-ined at the end of the header
 60#   define AUX778076_APPLY_PARAMS(param) \
 61    BOOST_MPL_PP_PARAMS( \
 62          BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
 63        , param \
 64        ) \
 65    /**/
 66
 67#   define AUX778076_APPLY_DEF_PARAMS(param, value) \
 68    BOOST_MPL_PP_DEFAULT_PARAMS( \
 69          BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
 70        , param \
 71        , value \
 72        ) \
 73    /**/
 74
 75#   define AUX778076_APPLY_N_PARAMS(n, param) \
 76    BOOST_MPL_PP_PARAMS(n, param) \
 77    /**/
 78
 79#   define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \
 80    BOOST_PP_COMMA_IF(n) \
 81    BOOST_MPL_PP_PARAMS(n, param) \
 82    /**/
 83
 84#   define AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \
 85    BOOST_PP_COMMA_IF(n) \
 86    BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \
 87    /**/
 88    
 89#   define AUX778076_APPLY_N_SPEC_PARAMS(n, param) \
 90    BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
 91    /**/
 92
 93
 94#define BOOST_PP_ITERATION_PARAMS_1 \
 95    (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply.hpp>))
 96#include BOOST_PP_ITERATE()
 97
 98#   if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
 99// real C++ version is already taken care of
100#   if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
101
102namespace aux {
103// apply_count_args
104#define AUX778076_COUNT_ARGS_PREFIX apply
105#define AUX778076_COUNT_ARGS_DEFAULT na
106#define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
107#include <boost/mpl/aux_/count_args.hpp>
108}
109
110
111template<
112      typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na)
113    >
114struct apply
115    : aux::apply_chooser< 
116          aux::apply_count_args< AUX778076_APPLY_PARAMS(T) >::value
117        >::template result_< F, AUX778076_APPLY_PARAMS(T) >::type
118{
119};
120
121#   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
122#   endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
123
124#   undef AUX778076_APPLY_N_SPEC_PARAMS
125#   undef AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS
126#   undef AUX778076_APPLY_N_COMMA_PARAMS
127#   undef AUX778076_APPLY_N_PARAMS
128#   undef AUX778076_APPLY_DEF_PARAMS
129#   undef AUX778076_APPLY_PARAMS
130
131}}
132
133#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
134#endif // BOOST_MPL_APPLY_HPP_INCLUDED
135
136///// iteration, depth == 1
137
138// For gcc 4.4 compatability, we must include the
139// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
140#else // BOOST_PP_IS_ITERATING
141#if BOOST_PP_ITERATION_DEPTH() == 1
142
143#   define i_ BOOST_PP_FRAME_ITERATION(1)
144
145template<
146      typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
147    >
148struct BOOST_PP_CAT(apply,i_)
149#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
150    : BOOST_PP_CAT(apply_wrap,i_)< 
151          typename lambda<F>::type
152        AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
153        >
154{
155#else
156{
157    typedef typename BOOST_PP_CAT(apply_wrap,i_)< 
158          typename lambda<F>::type
159        AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
160        >::type type;
161#endif
162    BOOST_MPL_AUX_LAMBDA_SUPPORT(
163          BOOST_PP_INC(i_)
164        , BOOST_PP_CAT(apply,i_)
165        , (F AUX778076_APPLY_N_COMMA_PARAMS(i_,T))
166        )
167};
168
169
170#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
171/// workaround for ETI bug
172template<>
173struct BOOST_PP_CAT(apply,i_)<AUX778076_APPLY_N_SPEC_PARAMS(i_, int)>
174{
175    typedef int type;
176};
177#endif
178
179#   if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
180#   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
181
182#if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
183/// primary template (not a specialization!)
184template<
185      typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
186    >
187struct apply
188    : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
189{
190};
191#else
192template<
193      typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
194    >
195struct apply< F AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(i_, T, na) >
196    : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
197{
198};
199#endif
200
201#   else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
202
203#if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
204namespace aux {
205
206template<>
207struct apply_chooser<i_>
208{
209    template<
210          typename F, AUX778076_APPLY_PARAMS(typename T)
211        >
212    struct result_
213    {
214        typedef BOOST_PP_CAT(apply,i_)<
215              F AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
216            > type;
217    };
218};
219
220} // namespace aux
221#endif
222
223#   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
224#   endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
225
226#   undef i_
227
228#endif // BOOST_PP_ITERATION_DEPTH()
229#endif // BOOST_PP_IS_ITERATING