os/ossrv/ossrv_pub/boost_apis/boost/mpl/inherit.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/mpl/inherit.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,229 @@
     1.4 +
     1.5 +#if !defined(BOOST_PP_IS_ITERATING)
     1.6 +
     1.7 +///// header body
     1.8 +
     1.9 +#ifndef BOOST_MPL_INHERIT_HPP_INCLUDED
    1.10 +#define BOOST_MPL_INHERIT_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/inherit.hpp,v $
    1.21 +// $Date: 2004/09/02 15:40:41 $
    1.22 +// $Revision: 1.5 $
    1.23 +
    1.24 +#if !defined(BOOST_MPL_PREPROCESSING_MODE)
    1.25 +#   include <boost/mpl/empty_base.hpp>
    1.26 +#   include <boost/mpl/aux_/na_spec.hpp>
    1.27 +#   include <boost/mpl/aux_/lambda_support.hpp>
    1.28 +#endif
    1.29 +
    1.30 +#include <boost/mpl/aux_/config/use_preprocessed.hpp>
    1.31 +
    1.32 +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
    1.33 +    && !defined(BOOST_MPL_PREPROCESSING_MODE)
    1.34 +
    1.35 +#   define BOOST_MPL_PREPROCESSED_HEADER inherit.hpp
    1.36 +#   include <boost/mpl/aux_/include_preprocessed.hpp>
    1.37 +
    1.38 +#else
    1.39 +
    1.40 +#   include <boost/mpl/limits/arity.hpp>
    1.41 +#   include <boost/mpl/aux_/preprocessor/params.hpp>
    1.42 +#   include <boost/mpl/aux_/preprocessor/default_params.hpp>
    1.43 +#   include <boost/mpl/aux_/preprocessor/enum.hpp>
    1.44 +#   include <boost/mpl/aux_/config/ctps.hpp>
    1.45 +#   include <boost/mpl/aux_/config/dtp.hpp>
    1.46 +
    1.47 +#   include <boost/preprocessor/iterate.hpp>
    1.48 +#   include <boost/preprocessor/dec.hpp>
    1.49 +#   include <boost/preprocessor/cat.hpp>
    1.50 +
    1.51 +namespace boost { namespace mpl {
    1.52 +
    1.53 +// 'inherit<T1,T2,..,Tn>' metafunction; returns an unspecified class type
    1.54 +// produced by public derivation from all metafunction's parameters 
    1.55 +// (T1,T2,..,Tn), except the parameters of 'empty_base' class type; 
    1.56 +// regardless the position and number of 'empty_base' parameters in the 
    1.57 +// metafunction's argument list, derivation from them is always a no-op;
    1.58 +// for instance:
    1.59 +//      inherit<her>::type == her
    1.60 +//      inherit<her,my>::type == struct unspecified : her, my {};
    1.61 +//      inherit<empty_base,her>::type == her
    1.62 +//      inherit<empty_base,her,empty_base,empty_base>::type == her
    1.63 +//      inherit<her,empty_base,my>::type == struct unspecified : her, my {};
    1.64 +//      inherit<empty_base,empty_base>::type == empty_base
    1.65 +
    1.66 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.67 +
    1.68 +template< 
    1.69 +      typename BOOST_MPL_AUX_NA_PARAM(T1)
    1.70 +    , typename BOOST_MPL_AUX_NA_PARAM(T2)
    1.71 +    > 
    1.72 +struct inherit2
    1.73 +    : T1, T2
    1.74 +{
    1.75 +    typedef inherit2 type;
    1.76 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, inherit2, (T1,T2))
    1.77 +};
    1.78 +
    1.79 +template< typename T1 > 
    1.80 +struct inherit2<T1,empty_base>
    1.81 +{
    1.82 +    typedef T1 type;
    1.83 +    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (T1,empty_base))
    1.84 +};
    1.85 +
    1.86 +template< typename T2 > 
    1.87 +struct inherit2<empty_base,T2>
    1.88 +{
    1.89 +    typedef T2 type;
    1.90 +    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base,T2))
    1.91 +};
    1.92 +
    1.93 +// needed to disambiguate the previous two in case when both 
    1.94 +// T1 and T2 == empty_base
    1.95 +template<> 
    1.96 +struct inherit2<empty_base,empty_base>
    1.97 +{
    1.98 +    typedef empty_base type;
    1.99 +    BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base,empty_base))
   1.100 +};
   1.101 +
   1.102 +#else
   1.103 +
   1.104 +namespace aux {
   1.105 +
   1.106 +template< bool C1, bool C2 >
   1.107 +struct inherit2_impl
   1.108 +{
   1.109 +    template< typename Derived, typename T1, typename T2 > struct result_ 
   1.110 +        : T1, T2
   1.111 +    {
   1.112 +        typedef Derived type_;
   1.113 +    };
   1.114 +};
   1.115 +
   1.116 +template<>
   1.117 +struct inherit2_impl<false,true>
   1.118 +{
   1.119 +    template< typename Derived, typename T1, typename T2 > struct result_
   1.120 +        : T1
   1.121 +    {
   1.122 +        typedef T1 type_;
   1.123 +    };
   1.124 +};
   1.125 +
   1.126 +template<>
   1.127 +struct inherit2_impl<true,false>
   1.128 +{
   1.129 +    template< typename Derived, typename T1, typename T2 > struct result_
   1.130 +        : T2 
   1.131 +    {
   1.132 +        typedef T2 type_;
   1.133 +    };
   1.134 +};
   1.135 +
   1.136 +template<>
   1.137 +struct inherit2_impl<true,true>
   1.138 +{
   1.139 +    template< typename Derived, typename T1, typename T2 > struct result_
   1.140 +    {
   1.141 +        typedef T1 type_;
   1.142 +    };
   1.143 +};
   1.144 +
   1.145 +} // namespace aux
   1.146 +
   1.147 +template< 
   1.148 +      typename BOOST_MPL_AUX_NA_PARAM(T1)
   1.149 +    , typename BOOST_MPL_AUX_NA_PARAM(T2)
   1.150 +    > 
   1.151 +struct inherit2
   1.152 +    : aux::inherit2_impl<
   1.153 +          is_empty_base<T1>::value
   1.154 +        , is_empty_base<T2>::value
   1.155 +        >::template result_< inherit2<T1,T2>,T1,T2 >
   1.156 +{
   1.157 +    typedef typename inherit2::type_ type;
   1.158 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, inherit2, (T1,T2))
   1.159 +};
   1.160 +
   1.161 +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   1.162 +
   1.163 +BOOST_MPL_AUX_NA_SPEC(2, inherit2)
   1.164 +
   1.165 +#define BOOST_PP_ITERATION_PARAMS_1 \
   1.166 +    (3,(3, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/inherit.hpp>))
   1.167 +#include BOOST_PP_ITERATE()
   1.168 +
   1.169 +}}
   1.170 +
   1.171 +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
   1.172 +#endif // BOOST_MPL_INHERIT_HPP_INCLUDED
   1.173 +
   1.174 +///// iteration
   1.175 +
   1.176 +#else
   1.177 +#define n_ BOOST_PP_FRAME_ITERATION(1)
   1.178 +
   1.179 +template<
   1.180 +      BOOST_MPL_PP_DEFAULT_PARAMS(n_, typename T, na)
   1.181 +    >
   1.182 +struct BOOST_PP_CAT(inherit,n_)
   1.183 +    : inherit2<
   1.184 +          typename BOOST_PP_CAT(inherit,BOOST_PP_DEC(n_))<
   1.185 +              BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(n_), T)
   1.186 +            >::type
   1.187 +        , BOOST_PP_CAT(T,n_)
   1.188 +        >
   1.189 +{
   1.190 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(
   1.191 +          n_
   1.192 +        , BOOST_PP_CAT(inherit,n_)
   1.193 +        , (BOOST_MPL_PP_PARAMS(n_, T))
   1.194 +        )
   1.195 +};
   1.196 +
   1.197 +BOOST_MPL_AUX_NA_SPEC(n_, BOOST_PP_CAT(inherit,n_))
   1.198 +
   1.199 +#if n_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
   1.200 +/// primary template
   1.201 +template<
   1.202 +      BOOST_MPL_PP_DEFAULT_PARAMS(n_, typename T, empty_base)
   1.203 +    >
   1.204 +struct inherit
   1.205 +    : BOOST_PP_CAT(inherit,n_)<BOOST_MPL_PP_PARAMS(n_, T)>
   1.206 +{
   1.207 +};
   1.208 +
   1.209 +// 'na' specialization
   1.210 +template<>
   1.211 +struct inherit< BOOST_MPL_PP_ENUM(5, na) >
   1.212 +{
   1.213 +    template<
   1.214 +#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
   1.215 +          BOOST_MPL_PP_DEFAULT_PARAMS(n_, typename T, empty_base)
   1.216 +#else
   1.217 +          BOOST_MPL_PP_PARAMS(n_, typename T)
   1.218 +#endif
   1.219 +        >
   1.220 +    struct apply
   1.221 +        : inherit< BOOST_MPL_PP_PARAMS(n_, T) >
   1.222 +    {
   1.223 +    };
   1.224 +};
   1.225 +
   1.226 +BOOST_MPL_AUX_NA_SPEC_LAMBDA(n_, inherit)
   1.227 +BOOST_MPL_AUX_NA_SPEC_ARITY(n_, inherit)
   1.228 +BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(n_, n_, inherit)
   1.229 +#endif
   1.230 +
   1.231 +#undef n_
   1.232 +#endif // BOOST_PP_IS_ITERATING