epoc32/include/stdapis/boost/mpl/if.hpp
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/boost/mpl/if.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/if.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,30 +1,135 @@
     1.4 -# /* Copyright (C) 2001
     1.5 -#  * Housemarque Oy
     1.6 -#  * http://www.housemarque.com
     1.7 -#  *
     1.8 -#  * Distributed under the Boost Software License, Version 1.0. (See
     1.9 -#  * accompanying file LICENSE_1_0.txt or copy at
    1.10 -#  * http://www.boost.org/LICENSE_1_0.txt)
    1.11 -#  */
    1.12 -#
    1.13 -# /* Revised by Paul Mensonides (2002) */
    1.14 -#
    1.15 -# /* See http://www.boost.org for most recent version. */
    1.16 -#
    1.17 -# ifndef BOOST_PREPROCESSOR_CONTROL_IF_HPP
    1.18 -# define BOOST_PREPROCESSOR_CONTROL_IF_HPP
    1.19 -#
    1.20 -# include <boost/preprocessor/config/config.hpp>
    1.21 -# include <boost/preprocessor/control/iif.hpp>
    1.22 -# include <boost/preprocessor/logical/bool.hpp>
    1.23 -#
    1.24 -# /* BOOST_PP_IF */
    1.25 -#
    1.26 -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
    1.27 -#    define BOOST_PP_IF(cond, t, f) BOOST_PP_IIF(BOOST_PP_BOOL(cond), t, f)
    1.28 -# else
    1.29 -#    define BOOST_PP_IF(cond, t, f) BOOST_PP_IF_I(cond, t, f)
    1.30 -#    define BOOST_PP_IF_I(cond, t, f) BOOST_PP_IIF(BOOST_PP_BOOL(cond), t, f)
    1.31 -# endif
    1.32 -#
    1.33 -# endif
    1.34 +
    1.35 +#ifndef BOOST_MPL_IF_HPP_INCLUDED
    1.36 +#define BOOST_MPL_IF_HPP_INCLUDED
    1.37 +
    1.38 +// Copyright Aleksey Gurtovoy 2000-2004
    1.39 +//
    1.40 +// Distributed under the Boost Software License, Version 1.0. 
    1.41 +// (See accompanying file LICENSE_1_0.txt or copy at 
    1.42 +// http://www.boost.org/LICENSE_1_0.txt)
    1.43 +//
    1.44 +// See http://www.boost.org/libs/mpl for documentation.
    1.45 +
    1.46 +// $Source: /cvsroot/boost/boost/boost/mpl/if.hpp,v $
    1.47 +// $Date: 2004/09/07 08:51:31 $
    1.48 +// $Revision: 1.25 $
    1.49 +
    1.50 +#include <boost/mpl/aux_/value_wknd.hpp>
    1.51 +#include <boost/mpl/aux_/static_cast.hpp>
    1.52 +#include <boost/mpl/aux_/na_spec.hpp>
    1.53 +#include <boost/mpl/aux_/lambda_support.hpp>
    1.54 +#include <boost/mpl/aux_/config/integral.hpp>
    1.55 +#include <boost/mpl/aux_/config/ctps.hpp>
    1.56 +#include <boost/mpl/aux_/config/workaround.hpp>
    1.57 +
    1.58 +namespace boost { namespace mpl {
    1.59 +
    1.60 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.61 +
    1.62 +template<
    1.63 +      bool C
    1.64 +    , typename T1
    1.65 +    , typename T2
    1.66 +    >
    1.67 +struct if_c
    1.68 +{
    1.69 +    typedef T1 type;
    1.70 +};
    1.71 +
    1.72 +template<
    1.73 +      typename T1
    1.74 +    , typename T2
    1.75 +    >
    1.76 +struct if_c<false,T1,T2>
    1.77 +{
    1.78 +    typedef T2 type;
    1.79 +};
    1.80 +
    1.81 +// agurt, 05/sep/04: nondescriptive parameter names for the sake of DigitalMars
    1.82 +// (and possibly MWCW < 8.0); see http://article.gmane.org/gmane.comp.lib.boost.devel/108959
    1.83 +template<
    1.84 +      typename BOOST_MPL_AUX_NA_PARAM(T1)
    1.85 +    , typename BOOST_MPL_AUX_NA_PARAM(T2)
    1.86 +    , typename BOOST_MPL_AUX_NA_PARAM(T3)
    1.87 +    >
    1.88 +struct if_
    1.89 +{
    1.90 + private:
    1.91 +    // agurt, 02/jan/03: two-step 'type' definition for the sake of aCC 
    1.92 +    typedef if_c<
    1.93 +#if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS)
    1.94 +          BOOST_MPL_AUX_VALUE_WKND(T1)::value
    1.95 +#else
    1.96 +          BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
    1.97 +#endif
    1.98 +        , T2
    1.99 +        , T3
   1.100 +        > almost_type_;
   1.101 + 
   1.102 + public:
   1.103 +    typedef typename almost_type_::type type;
   1.104 +    
   1.105 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(T1,T2,T3))
   1.106 +};
   1.107 +
   1.108 +#else
   1.109 +
   1.110 +// no partial class template specialization
   1.111 +
   1.112 +namespace aux {
   1.113 +
   1.114 +template< bool C >
   1.115 +struct if_impl
   1.116 +{
   1.117 +    template< typename T1, typename T2 > struct result_
   1.118 +    {
   1.119 +        typedef T1 type;
   1.120 +    };
   1.121 +};
   1.122 +
   1.123 +template<>
   1.124 +struct if_impl<false>
   1.125 +{
   1.126 +    template< typename T1, typename T2 > struct result_
   1.127 +    { 
   1.128 +        typedef T2 type;
   1.129 +    };
   1.130 +};
   1.131 +
   1.132 +} // namespace aux
   1.133 +
   1.134 +template<
   1.135 +      bool C_
   1.136 +    , typename T1
   1.137 +    , typename T2
   1.138 +    >
   1.139 +struct if_c
   1.140 +{
   1.141 +    typedef typename aux::if_impl< C_ >
   1.142 +        ::template result_<T1,T2>::type type;
   1.143 +};
   1.144 +
   1.145 +// (almost) copy & paste in order to save one more 
   1.146 +// recursively nested template instantiation to user
   1.147 +template<
   1.148 +      typename BOOST_MPL_AUX_NA_PARAM(C_)
   1.149 +    , typename BOOST_MPL_AUX_NA_PARAM(T1)
   1.150 +    , typename BOOST_MPL_AUX_NA_PARAM(T2)
   1.151 +    >
   1.152 +struct if_
   1.153 +{
   1.154 +    enum { msvc_wknd_ = BOOST_MPL_AUX_MSVC_VALUE_WKND(C_)::value };
   1.155 +
   1.156 +    typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, msvc_wknd_) >
   1.157 +        ::template result_<T1,T2>::type type;
   1.158 +
   1.159 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2))
   1.160 +};
   1.161 +
   1.162 +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   1.163 +
   1.164 +BOOST_MPL_AUX_NA_SPEC(3, if_)
   1.165 +
   1.166 +}}
   1.167 +
   1.168 +#endif // BOOST_MPL_IF_HPP_INCLUDED