1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/mpl/apply_wrap.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,200 @@
1.4 +
1.5 +#if !defined(BOOST_PP_IS_ITERATING)
1.6 +
1.7 +///// header body
1.8 +
1.9 +#ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
1.10 +#define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
1.11 +
1.12 +// Copyright Aleksey Gurtovoy 2000-2004
1.13 +//
1.14 +// Distributed under the Boost Software License, Version 1.0.
1.15 +// (See accompanying file LICENSE_1_0.txt or copy at
1.16 +// http://www.boost.org/LICENSE_1_0.txt)
1.17 +//
1.18 +// See http://www.boost.org/libs/mpl for documentation.
1.19 +
1.20 +// $Source: /cvsroot/boost/boost/boost/mpl/apply_wrap.hpp,v $
1.21 +// $Date: 2004/09/03 15:56:55 $
1.22 +// $Revision: 1.3 $
1.23 +
1.24 +#if !defined(BOOST_MPL_PREPROCESSING_MODE)
1.25 +# include <boost/mpl/aux_/arity.hpp>
1.26 +# include <boost/mpl/aux_/has_apply.hpp>
1.27 +# include <boost/mpl/aux_/na.hpp>
1.28 +# include <boost/mpl/aux_/msvc_never_true.hpp>
1.29 +#endif
1.30 +
1.31 +#include <boost/mpl/aux_/config/use_preprocessed.hpp>
1.32 +
1.33 +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
1.34 + && !defined(BOOST_MPL_PREPROCESSING_MODE)
1.35 +
1.36 +# define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp
1.37 +# include <boost/mpl/aux_/include_preprocessed.hpp>
1.38 +
1.39 +#else
1.40 +
1.41 +# include <boost/mpl/limits/arity.hpp>
1.42 +# include <boost/mpl/aux_/preprocessor/params.hpp>
1.43 +# include <boost/mpl/aux_/preprocessor/enum.hpp>
1.44 +# include <boost/mpl/aux_/preprocessor/add.hpp>
1.45 +# include <boost/mpl/aux_/config/dtp.hpp>
1.46 +# include <boost/mpl/aux_/config/eti.hpp>
1.47 +# include <boost/mpl/aux_/config/ctps.hpp>
1.48 +# include <boost/mpl/aux_/config/msvc.hpp>
1.49 +# include <boost/mpl/aux_/config/workaround.hpp>
1.50 +
1.51 +# include <boost/preprocessor/comma_if.hpp>
1.52 +# include <boost/preprocessor/logical/and.hpp>
1.53 +# include <boost/preprocessor/inc.hpp>
1.54 +# include <boost/preprocessor/iterate.hpp>
1.55 +
1.56 +
1.57 +namespace boost { namespace mpl {
1.58 +
1.59 +// local macros, #undef-ined at the end of the header
1.60 +# define AUX778076_APPLY_WRAP_PARAMS(n, param) \
1.61 + BOOST_MPL_PP_PARAMS(n, param) \
1.62 + /**/
1.63 +
1.64 +# define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \
1.65 + BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
1.66 + /**/
1.67 +
1.68 +
1.69 +#define BOOST_PP_ITERATION_PARAMS_1 \
1.70 + (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply_wrap.hpp>))
1.71 +#include BOOST_PP_ITERATE()
1.72 +
1.73 +
1.74 +# undef AUX778076_APPLY_WRAP_SPEC_PARAMS
1.75 +# undef AUX778076_APPLY_WRAP_PARAMS
1.76 +
1.77 +}}
1.78 +
1.79 +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
1.80 +#endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
1.81 +
1.82 +///// iteration, depth == 1
1.83 +
1.84 +#elif BOOST_PP_ITERATION_DEPTH() == 1
1.85 +
1.86 +# define i_ BOOST_PP_FRAME_ITERATION(1)
1.87 +
1.88 +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
1.89 +// MSVC version
1.90 +
1.91 +#define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_)
1.92 +#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply
1.93 +#define AUX778076_MSVC_DTW_ARITY i_
1.94 +#include <boost/mpl/aux_/msvc_dtw.hpp>
1.95 +
1.96 +template<
1.97 + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
1.98 + >
1.99 +struct BOOST_PP_CAT(apply_wrap,i_)
1.100 +{
1.101 + // Metafunction forwarding confuses vc6
1.102 + typedef typename BOOST_PP_CAT(msvc_apply,i_)<F>::template result_<
1.103 + AUX778076_APPLY_WRAP_PARAMS(i_, T)
1.104 + >::type type;
1.105 +};
1.106 +
1.107 +# elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
1.108 +// MWCW/Borland version
1.109 +
1.110 +template<
1.111 + int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
1.112 + >
1.113 +struct BOOST_PP_CAT(apply_wrap_impl,i_);
1.114 +
1.115 +#define BOOST_PP_ITERATION_PARAMS_2 \
1.116 + (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, <boost/mpl/apply_wrap.hpp>))
1.117 +#include BOOST_PP_ITERATE()
1.118 +
1.119 +template<
1.120 + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
1.121 + >
1.122 +struct BOOST_PP_CAT(apply_wrap,i_)
1.123 + : BOOST_PP_CAT(apply_wrap_impl,i_)<
1.124 + ::boost::mpl::aux::arity<F,i_>::value
1.125 + , F
1.126 + BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
1.127 + >::type
1.128 +{
1.129 +};
1.130 +
1.131 +# else
1.132 +// ISO98 C++, with minor concession to vc7
1.133 +
1.134 +template<
1.135 + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
1.136 +#if i_ == 0
1.137 + , typename has_apply_ = typename aux::has_apply<F>::type
1.138 +#endif
1.139 + >
1.140 +struct BOOST_PP_CAT(apply_wrap,i_)
1.141 +// metafunction forwarding confuses MSVC 7.0
1.142 +#if !BOOST_WORKAROUND(BOOST_MSVC, == 1300)
1.143 + : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) >
1.144 +{
1.145 +#else
1.146 +{
1.147 + typedef typename F::template apply<
1.148 + AUX778076_APPLY_WRAP_PARAMS(i_, T)
1.149 + >::type type;
1.150 +#endif
1.151 +};
1.152 +
1.153 +#if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
1.154 +template< typename F >
1.155 +struct BOOST_PP_CAT(apply_wrap,i_)<F,true_>
1.156 + : F::apply
1.157 +{
1.158 +};
1.159 +#endif
1.160 +
1.161 +# endif // workarounds
1.162 +
1.163 +#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
1.164 +/// workaround for ETI bug
1.165 +template<>
1.166 +struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)>
1.167 +{
1.168 + typedef int type;
1.169 +};
1.170 +#endif
1.171 +
1.172 +# undef i_
1.173 +
1.174 +///// iteration, depth == 2
1.175 +
1.176 +#elif BOOST_PP_ITERATION_DEPTH() == 2
1.177 +
1.178 +# define j_ BOOST_PP_FRAME_ITERATION(2)
1.179 +
1.180 +template<
1.181 + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
1.182 + >
1.183 +struct BOOST_PP_CAT(apply_wrap_impl,i_)<
1.184 + BOOST_MPL_PP_ADD(i_, j_)
1.185 + , F
1.186 + BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
1.187 + >
1.188 +{
1.189 + typedef typename F::template apply<
1.190 + AUX778076_APPLY_WRAP_PARAMS(i_, T)
1.191 +#if i_ == 0 && j_ == 0
1.192 +/// since the defaults are "lost", we have to pass *something* even for nullary
1.193 +/// metafunction classes
1.194 + na
1.195 +#else
1.196 + BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na)
1.197 +#endif
1.198 + > type;
1.199 +};
1.200 +
1.201 +# undef j_
1.202 +
1.203 +#endif // BOOST_PP_IS_ITERATING