epoc32/include/stdapis/boost/mpl/aux_/numeric_op.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/aux_/numeric_op.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,311 @@
     1.4 +
     1.5 +#if !defined(BOOST_PP_IS_ITERATING)
     1.6 +
     1.7 +///// header body
     1.8 +
     1.9 +// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION!
    1.10 +
    1.11 +// Copyright Aleksey Gurtovoy 2000-2004
    1.12 +//
    1.13 +// Distributed under the Boost Software License, Version 1.0. 
    1.14 +// (See accompanying file LICENSE_1_0.txt or copy at 
    1.15 +// http://www.boost.org/LICENSE_1_0.txt)
    1.16 +//
    1.17 +// See http://www.boost.org/libs/mpl for documentation.
    1.18 +
    1.19 +// $Source: /cvsroot/boost/boost/boost/mpl/aux_/numeric_op.hpp,v $
    1.20 +// $Date: 2005/08/25 16:27:21 $
    1.21 +// $Revision: 1.10 $
    1.22 +
    1.23 +#if !defined(BOOST_MPL_PREPROCESSING_MODE)
    1.24 +#   include <boost/mpl/numeric_cast.hpp>
    1.25 +#   include <boost/mpl/apply_wrap.hpp>
    1.26 +#   include <boost/mpl/if.hpp>
    1.27 +#   include <boost/mpl/tag.hpp>
    1.28 +#   include <boost/mpl/aux_/numeric_cast_utils.hpp>
    1.29 +#   include <boost/mpl/aux_/na.hpp>
    1.30 +#   include <boost/mpl/aux_/na_spec.hpp>
    1.31 +#   include <boost/mpl/aux_/lambda_support.hpp>
    1.32 +#   include <boost/mpl/aux_/msvc_eti_base.hpp>
    1.33 +#   include <boost/mpl/aux_/value_wknd.hpp>
    1.34 +#   include <boost/mpl/aux_/config/eti.hpp>
    1.35 +#   include <boost/mpl/aux_/nttp_decl.hpp>
    1.36 +#endif
    1.37 +
    1.38 +#include <boost/mpl/aux_/config/static_constant.hpp>
    1.39 +
    1.40 +#if defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
    1.41 +    || defined(BOOST_MPL_PREPROCESSING_MODE)
    1.42 +
    1.43 +#   include <boost/mpl/limits/arity.hpp>
    1.44 +#   include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
    1.45 +#   include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
    1.46 +#   include <boost/mpl/aux_/preprocessor/repeat.hpp>
    1.47 +#   include <boost/mpl/aux_/preprocessor/ext_params.hpp>
    1.48 +#   include <boost/mpl/aux_/preprocessor/params.hpp>
    1.49 +#   include <boost/mpl/aux_/preprocessor/enum.hpp>
    1.50 +#   include <boost/mpl/aux_/preprocessor/add.hpp>
    1.51 +#   include <boost/mpl/aux_/preprocessor/sub.hpp>
    1.52 +#   include <boost/mpl/aux_/config/ctps.hpp>
    1.53 +#   include <boost/mpl/aux_/config/eti.hpp>
    1.54 +#   include <boost/mpl/aux_/config/msvc.hpp>
    1.55 +#   include <boost/mpl/aux_/config/workaround.hpp>
    1.56 +
    1.57 +#   include <boost/preprocessor/dec.hpp>
    1.58 +#   include <boost/preprocessor/inc.hpp>
    1.59 +#   include <boost/preprocessor/iterate.hpp>
    1.60 +#   include <boost/preprocessor/cat.hpp>
    1.61 +
    1.62 +
    1.63 +#if !defined(AUX778076_OP_ARITY)
    1.64 +#   define AUX778076_OP_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
    1.65 +#endif
    1.66 +
    1.67 +#if !defined(AUX778076_OP_IMPL_NAME)
    1.68 +#   define AUX778076_OP_IMPL_NAME BOOST_PP_CAT(AUX778076_OP_PREFIX,_impl)
    1.69 +#endif
    1.70 +
    1.71 +#if !defined(AUX778076_OP_TAG_NAME)
    1.72 +#   define AUX778076_OP_TAG_NAME BOOST_PP_CAT(AUX778076_OP_PREFIX,_tag)
    1.73 +#endif
    1.74 +
    1.75 +namespace boost { namespace mpl {
    1.76 +
    1.77 +template< 
    1.78 +      typename Tag1
    1.79 +    , typename Tag2
    1.80 +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
    1.81 +    , BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value 
    1.82 +    , BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value 
    1.83 +    >
    1.84 +struct AUX778076_OP_IMPL_NAME
    1.85 +    : if_c<
    1.86 +          ( tag1_ > tag2_ )
    1.87 +#else
    1.88 +    >
    1.89 +struct AUX778076_OP_IMPL_NAME
    1.90 +    : if_c<
    1.91 +          ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
    1.92 +              > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
    1.93 +            )
    1.94 +#endif
    1.95 +        , aux::cast2nd_impl< AUX778076_OP_IMPL_NAME<Tag1,Tag1>,Tag1,Tag2 >
    1.96 +        , aux::cast1st_impl< AUX778076_OP_IMPL_NAME<Tag2,Tag2>,Tag1,Tag2 >
    1.97 +        >::type
    1.98 +{
    1.99 +};
   1.100 +
   1.101 +/// for Digital Mars C++/compilers with no CTPS/TTP support
   1.102 +template<> struct AUX778076_OP_IMPL_NAME<na,na>
   1.103 +{
   1.104 +    template< typename U1, typename U2 > struct apply 
   1.105 +    {
   1.106 +        typedef apply type;
   1.107 +        BOOST_STATIC_CONSTANT(int, value = 0);
   1.108 +    };
   1.109 +};
   1.110 +
   1.111 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
   1.112 +template< typename Tag > struct AUX778076_OP_IMPL_NAME<na,Tag>
   1.113 +{
   1.114 +    template< typename U1, typename U2 > struct apply 
   1.115 +    {
   1.116 +        typedef apply type;
   1.117 +        BOOST_STATIC_CONSTANT(int, value = 0);
   1.118 +    };
   1.119 +};
   1.120 +
   1.121 +template< typename Tag > struct AUX778076_OP_IMPL_NAME<Tag,na>
   1.122 +{
   1.123 +    template< typename U1, typename U2 > struct apply 
   1.124 +    {
   1.125 +        typedef apply type;
   1.126 +        BOOST_STATIC_CONSTANT(int, value = 0);
   1.127 +    };
   1.128 +};
   1.129 +#else
   1.130 +template<> struct AUX778076_OP_IMPL_NAME<na,integral_c_tag>
   1.131 +{
   1.132 +    template< typename U1, typename U2 > struct apply 
   1.133 +    {
   1.134 +        typedef apply type;
   1.135 +        BOOST_STATIC_CONSTANT(int, value = 0);
   1.136 +    };
   1.137 +};
   1.138 +
   1.139 +template<> struct AUX778076_OP_IMPL_NAME<integral_c_tag,na>
   1.140 +{
   1.141 +    template< typename U1, typename U2 > struct apply 
   1.142 +    {
   1.143 +        typedef apply type;
   1.144 +        BOOST_STATIC_CONSTANT(int, value = 0);
   1.145 +    };
   1.146 +};
   1.147 +#endif
   1.148 +
   1.149 +
   1.150 +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
   1.151 +    && BOOST_WORKAROUND(BOOST_MSVC, >= 1300)
   1.152 +template< typename T > struct AUX778076_OP_TAG_NAME
   1.153 +    : tag<T,na>
   1.154 +{
   1.155 +};
   1.156 +#else
   1.157 +template< typename T > struct AUX778076_OP_TAG_NAME
   1.158 +{
   1.159 +    typedef typename T::tag type;
   1.160 +};
   1.161 +#endif
   1.162 +
   1.163 +
   1.164 +#if AUX778076_OP_ARITY != 2
   1.165 +
   1.166 +#   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
   1.167 +
   1.168 +#   define AUX778076_OP_RIGHT_OPERAND(unused, i, N) , BOOST_PP_CAT(N, BOOST_MPL_PP_ADD(i, 2))>
   1.169 +#   define AUX778076_OP_N_CALLS(i, N) \
   1.170 +    BOOST_MPL_PP_REPEAT( BOOST_PP_DEC(i), BOOST_MPL_PP_REPEAT_IDENTITY_FUNC, AUX778076_OP_NAME< ) \
   1.171 +    N1 BOOST_MPL_PP_REPEAT( BOOST_MPL_PP_SUB(i, 1), AUX778076_OP_RIGHT_OPERAND, N ) \
   1.172 +/**/
   1.173 +
   1.174 +template<
   1.175 +      typename BOOST_MPL_AUX_NA_PARAM(N1)
   1.176 +    , typename BOOST_MPL_AUX_NA_PARAM(N2)
   1.177 +    BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename N, na)
   1.178 +    >
   1.179 +struct AUX778076_OP_NAME
   1.180 +    : AUX778076_OP_N_CALLS(AUX778076_OP_ARITY, N)
   1.181 +{
   1.182 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(
   1.183 +          AUX778076_OP_ARITY
   1.184 +        , AUX778076_OP_NAME
   1.185 +        , ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
   1.186 +        )
   1.187 +};
   1.188 +
   1.189 +#define BOOST_PP_ITERATION_PARAMS_1 \
   1.190 +    (3,( BOOST_PP_DEC(AUX778076_OP_ARITY), 2, <boost/mpl/aux_/numeric_op.hpp> ))
   1.191 +#include BOOST_PP_ITERATE()
   1.192 +
   1.193 +#   undef AUX778076_OP_N_CALLS
   1.194 +#   undef AUX778076_OP_RIGHT_OPERAND
   1.195 +
   1.196 +#   else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   1.197 +
   1.198 +/// forward declaration
   1.199 +template< 
   1.200 +      typename BOOST_MPL_AUX_NA_PARAM(N1)
   1.201 +    , typename BOOST_MPL_AUX_NA_PARAM(N2)
   1.202 +    >
   1.203 +struct BOOST_PP_CAT(AUX778076_OP_NAME,2);
   1.204 +
   1.205 +template<
   1.206 +      typename BOOST_MPL_AUX_NA_PARAM(N1)
   1.207 +    , typename BOOST_MPL_AUX_NA_PARAM(N2)
   1.208 +    BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename N, na)
   1.209 +    >
   1.210 +struct AUX778076_OP_NAME
   1.211 +#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
   1.212 +    : aux::msvc_eti_base< typename if_<
   1.213 +#else
   1.214 +    : if_<
   1.215 +#endif
   1.216 +          is_na<N3>
   1.217 +        , BOOST_PP_CAT(AUX778076_OP_NAME,2)<N1,N2>
   1.218 +        , AUX778076_OP_NAME<
   1.219 +              BOOST_PP_CAT(AUX778076_OP_NAME,2)<N1,N2>
   1.220 +            , BOOST_MPL_PP_EXT_PARAMS(3, BOOST_PP_INC(AUX778076_OP_ARITY), N)
   1.221 +            >
   1.222 +        >::type
   1.223 +#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
   1.224 +    >
   1.225 +#endif
   1.226 +{
   1.227 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(
   1.228 +          AUX778076_OP_ARITY
   1.229 +        , AUX778076_OP_NAME
   1.230 +        , ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
   1.231 +        )
   1.232 +};
   1.233 +
   1.234 +template< 
   1.235 +      typename N1
   1.236 +    , typename N2
   1.237 +    >
   1.238 +struct BOOST_PP_CAT(AUX778076_OP_NAME,2)
   1.239 +
   1.240 +#endif
   1.241 +
   1.242 +#else // AUX778076_OP_ARITY == 2
   1.243 +
   1.244 +template< 
   1.245 +      typename BOOST_MPL_AUX_NA_PARAM(N1)
   1.246 +    , typename BOOST_MPL_AUX_NA_PARAM(N2)
   1.247 +    >
   1.248 +struct AUX778076_OP_NAME
   1.249 +
   1.250 +#endif
   1.251 +
   1.252 +#if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
   1.253 +    : AUX778076_OP_IMPL_NAME<
   1.254 +          typename AUX778076_OP_TAG_NAME<N1>::type
   1.255 +        , typename AUX778076_OP_TAG_NAME<N2>::type
   1.256 +        >::template apply<N1,N2>::type
   1.257 +#else
   1.258 +    : aux::msvc_eti_base< typename apply_wrap2<
   1.259 +          AUX778076_OP_IMPL_NAME<
   1.260 +              typename AUX778076_OP_TAG_NAME<N1>::type
   1.261 +            , typename AUX778076_OP_TAG_NAME<N2>::type
   1.262 +            >
   1.263 +        , N1
   1.264 +        , N2
   1.265 +        >::type >::type
   1.266 +#endif
   1.267 +{
   1.268 +#if AUX778076_OP_ARITY != 2
   1.269 +
   1.270 +#   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
   1.271 +    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
   1.272 +          AUX778076_OP_ARITY
   1.273 +        , AUX778076_OP_NAME
   1.274 +        , ( BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(2, N, na) )
   1.275 +        )
   1.276 +#   else
   1.277 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, BOOST_PP_CAT(AUX778076_OP_NAME,2), (N1, N2))
   1.278 +#   endif
   1.279 +
   1.280 +#else
   1.281 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, AUX778076_OP_NAME, (N1, N2))
   1.282 +#endif
   1.283 +};
   1.284 +
   1.285 +BOOST_MPL_AUX_NA_SPEC2(2, AUX778076_OP_ARITY, AUX778076_OP_NAME)
   1.286 +
   1.287 +}}
   1.288 +
   1.289 +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
   1.290 +
   1.291 +///// iteration, depth == 1
   1.292 +
   1.293 +#elif BOOST_PP_ITERATION_DEPTH() == 1
   1.294 +
   1.295 +#   define i_ BOOST_PP_FRAME_ITERATION(1)
   1.296 +
   1.297 +template<
   1.298 +      BOOST_MPL_PP_PARAMS(i_, typename N)
   1.299 +    >
   1.300 +struct AUX778076_OP_NAME<BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na)>
   1.301 +#if i_ != 2
   1.302 +    : AUX778076_OP_N_CALLS(i_, N)
   1.303 +{
   1.304 +    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
   1.305 +          AUX778076_OP_ARITY
   1.306 +        , AUX778076_OP_NAME
   1.307 +        , ( BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na) )
   1.308 +        )
   1.309 +};
   1.310 +#endif
   1.311 +
   1.312 +#   undef i_
   1.313 +
   1.314 +#endif // BOOST_PP_IS_ITERATING