epoc32/include/stdapis/boost/mpl/aux_/template_arity.hpp
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/aux_/template_arity.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,189 @@
     1.4 +
     1.5 +#if !defined(BOOST_PP_IS_ITERATING)
     1.6 +
     1.7 +///// header body
     1.8 +
     1.9 +#ifndef BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
    1.10 +#define BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
    1.11 +
    1.12 +// Copyright Aleksey Gurtovoy 2001-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/aux_/template_arity.hpp,v $
    1.21 +// $Date: 2004/09/07 12:24:48 $
    1.22 +// $Revision: 1.11 $
    1.23 +
    1.24 +#include <boost/mpl/aux_/config/ttp.hpp>
    1.25 +#include <boost/mpl/aux_/config/lambda.hpp>
    1.26 +
    1.27 +#if !defined(BOOST_MPL_PREPROCESSING_MODE)
    1.28 +#   include <boost/mpl/aux_/template_arity_fwd.hpp>
    1.29 +#   include <boost/mpl/int.hpp>
    1.30 +#   if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
    1.31 +#   if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
    1.32 +#       include <boost/mpl/aux_/type_wrapper.hpp>
    1.33 +#   endif
    1.34 +#   else
    1.35 +#       include <boost/mpl/aux_/has_rebind.hpp>
    1.36 +#   endif
    1.37 +#endif
    1.38 +
    1.39 +#include <boost/mpl/aux_/config/static_constant.hpp>
    1.40 +#include <boost/mpl/aux_/config/use_preprocessed.hpp>
    1.41 +
    1.42 +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
    1.43 +    && !defined(BOOST_MPL_PREPROCESSING_MODE)
    1.44 +
    1.45 +#   define BOOST_MPL_PREPROCESSED_HEADER template_arity.hpp
    1.46 +#   include <boost/mpl/aux_/include_preprocessed.hpp>
    1.47 +
    1.48 +#else
    1.49 +
    1.50 +#   if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
    1.51 +#   if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
    1.52 +
    1.53 +#   include <boost/mpl/limits/arity.hpp>
    1.54 +#   include <boost/mpl/aux_/preprocessor/range.hpp>
    1.55 +#   include <boost/mpl/aux_/preprocessor/repeat.hpp>
    1.56 +#   include <boost/mpl/aux_/preprocessor/params.hpp>
    1.57 +#   include <boost/mpl/aux_/nttp_decl.hpp>
    1.58 +
    1.59 +#   include <boost/preprocessor/seq/fold_left.hpp>
    1.60 +#   include <boost/preprocessor/comma_if.hpp>
    1.61 +#   include <boost/preprocessor/iterate.hpp>
    1.62 +#   include <boost/preprocessor/inc.hpp>
    1.63 +#   include <boost/preprocessor/cat.hpp>
    1.64 +
    1.65 +#   define AUX778076_ARITY BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
    1.66 +
    1.67 +namespace boost { namespace mpl { namespace aux {
    1.68 +
    1.69 +template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct arity_tag
    1.70 +{
    1.71 +    typedef char (&type)[N + 1];
    1.72 +};
    1.73 +
    1.74 +#   define AUX778076_MAX_ARITY_OP(unused, state, i_) \
    1.75 +    ( BOOST_PP_CAT(C,i_) > 0 ? BOOST_PP_CAT(C,i_) : state ) \
    1.76 +/**/
    1.77 +
    1.78 +template<
    1.79 +      BOOST_MPL_PP_PARAMS(AUX778076_ARITY, BOOST_MPL_AUX_NTTP_DECL(int, C))
    1.80 +    >
    1.81 +struct max_arity
    1.82 +{
    1.83 +    BOOST_STATIC_CONSTANT(int, value = 
    1.84 +          BOOST_PP_SEQ_FOLD_LEFT(
    1.85 +              AUX778076_MAX_ARITY_OP
    1.86 +            , -1
    1.87 +            , BOOST_MPL_PP_RANGE(1, AUX778076_ARITY)
    1.88 +            )
    1.89 +        );
    1.90 +};
    1.91 +
    1.92 +#   undef AUX778076_MAX_ARITY_OP
    1.93 +
    1.94 +arity_tag<0>::type arity_helper(...);
    1.95 +
    1.96 +#   define BOOST_PP_ITERATION_LIMITS (1, AUX778076_ARITY)
    1.97 +#   define BOOST_PP_FILENAME_1 <boost/mpl/aux_/template_arity.hpp>
    1.98 +#   include BOOST_PP_ITERATE()
    1.99 +
   1.100 +template< typename F, BOOST_MPL_AUX_NTTP_DECL(int, N) >
   1.101 +struct template_arity_impl
   1.102 +{
   1.103 +    BOOST_STATIC_CONSTANT(int, value = 
   1.104 +          sizeof(arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
   1.105 +        );
   1.106 +};
   1.107 +
   1.108 +#   define AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION(unused, i_, F) \
   1.109 +    BOOST_PP_COMMA_IF(i_) template_arity_impl<F,BOOST_PP_INC(i_)>::value \
   1.110 +/**/
   1.111 +
   1.112 +template< typename F >
   1.113 +struct template_arity
   1.114 +{
   1.115 +    BOOST_STATIC_CONSTANT(int, value = (
   1.116 +          max_arity< BOOST_MPL_PP_REPEAT(
   1.117 +              AUX778076_ARITY
   1.118 +            , AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION
   1.119 +            , F
   1.120 +            ) >::value
   1.121 +        ));
   1.122 +        
   1.123 +    typedef mpl::int_<value> type;
   1.124 +};
   1.125 +
   1.126 +#   undef AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION
   1.127 +
   1.128 +#   undef AUX778076_ARITY
   1.129 +
   1.130 +}}}
   1.131 +
   1.132 +#   endif // BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
   1.133 +#   else // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
   1.134 +
   1.135 +#   include <boost/mpl/aux_/config/eti.hpp>
   1.136 +
   1.137 +namespace boost { namespace mpl { namespace aux {
   1.138 +
   1.139 +template< bool >
   1.140 +struct template_arity_impl
   1.141 +{
   1.142 +    template< typename F > struct result_
   1.143 +        : mpl::int_<-1>
   1.144 +    {
   1.145 +    };
   1.146 +};
   1.147 +
   1.148 +template<>
   1.149 +struct template_arity_impl<true>
   1.150 +{
   1.151 +    template< typename F > struct result_
   1.152 +        : F::arity
   1.153 +    {
   1.154 +    };
   1.155 +};
   1.156 +
   1.157 +template< typename F >
   1.158 +struct template_arity
   1.159 +    : template_arity_impl< ::boost::mpl::aux::has_rebind<F>::value >
   1.160 +        ::template result_<F>
   1.161 +{
   1.162 +};
   1.163 +
   1.164 +#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
   1.165 +template<>
   1.166 +struct template_arity<int>
   1.167 +    : mpl::int_<-1>
   1.168 +{
   1.169 +};
   1.170 +#endif
   1.171 +
   1.172 +}}}
   1.173 +
   1.174 +#   endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
   1.175 +
   1.176 +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
   1.177 +#endif // BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
   1.178 +
   1.179 +///// iteration
   1.180 +
   1.181 +#else
   1.182 +#define i_ BOOST_PP_FRAME_ITERATION(1)
   1.183 +
   1.184 +template<
   1.185 +      template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
   1.186 +    , BOOST_MPL_PP_PARAMS(i_, typename T)
   1.187 +    >
   1.188 +typename arity_tag<i_>::type
   1.189 +arity_helper(type_wrapper< F<BOOST_MPL_PP_PARAMS(i_, T)> >, arity_tag<i_>);
   1.190 +
   1.191 +#undef i_
   1.192 +#endif // BOOST_PP_IS_ITERATING