1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/mpl/if.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,135 @@
1.4 +
1.5 +#ifndef BOOST_MPL_IF_HPP_INCLUDED
1.6 +#define BOOST_MPL_IF_HPP_INCLUDED
1.7 +
1.8 +// Copyright Aleksey Gurtovoy 2000-2004
1.9 +//
1.10 +// Distributed under the Boost Software License, Version 1.0.
1.11 +// (See accompanying file LICENSE_1_0.txt or copy at
1.12 +// http://www.boost.org/LICENSE_1_0.txt)
1.13 +//
1.14 +// See http://www.boost.org/libs/mpl for documentation.
1.15 +
1.16 +// $Source: /cvsroot/boost/boost/boost/mpl/if.hpp,v $
1.17 +// $Date: 2004/09/07 08:51:31 $
1.18 +// $Revision: 1.25 $
1.19 +
1.20 +#include <boost/mpl/aux_/value_wknd.hpp>
1.21 +#include <boost/mpl/aux_/static_cast.hpp>
1.22 +#include <boost/mpl/aux_/na_spec.hpp>
1.23 +#include <boost/mpl/aux_/lambda_support.hpp>
1.24 +#include <boost/mpl/aux_/config/integral.hpp>
1.25 +#include <boost/mpl/aux_/config/ctps.hpp>
1.26 +#include <boost/mpl/aux_/config/workaround.hpp>
1.27 +
1.28 +namespace boost { namespace mpl {
1.29 +
1.30 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
1.31 +
1.32 +template<
1.33 + bool C
1.34 + , typename T1
1.35 + , typename T2
1.36 + >
1.37 +struct if_c
1.38 +{
1.39 + typedef T1 type;
1.40 +};
1.41 +
1.42 +template<
1.43 + typename T1
1.44 + , typename T2
1.45 + >
1.46 +struct if_c<false,T1,T2>
1.47 +{
1.48 + typedef T2 type;
1.49 +};
1.50 +
1.51 +// agurt, 05/sep/04: nondescriptive parameter names for the sake of DigitalMars
1.52 +// (and possibly MWCW < 8.0); see http://article.gmane.org/gmane.comp.lib.boost.devel/108959
1.53 +template<
1.54 + typename BOOST_MPL_AUX_NA_PARAM(T1)
1.55 + , typename BOOST_MPL_AUX_NA_PARAM(T2)
1.56 + , typename BOOST_MPL_AUX_NA_PARAM(T3)
1.57 + >
1.58 +struct if_
1.59 +{
1.60 + private:
1.61 + // agurt, 02/jan/03: two-step 'type' definition for the sake of aCC
1.62 + typedef if_c<
1.63 +#if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS)
1.64 + BOOST_MPL_AUX_VALUE_WKND(T1)::value
1.65 +#else
1.66 + BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
1.67 +#endif
1.68 + , T2
1.69 + , T3
1.70 + > almost_type_;
1.71 +
1.72 + public:
1.73 + typedef typename almost_type_::type type;
1.74 +
1.75 + BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(T1,T2,T3))
1.76 +};
1.77 +
1.78 +#else
1.79 +
1.80 +// no partial class template specialization
1.81 +
1.82 +namespace aux {
1.83 +
1.84 +template< bool C >
1.85 +struct if_impl
1.86 +{
1.87 + template< typename T1, typename T2 > struct result_
1.88 + {
1.89 + typedef T1 type;
1.90 + };
1.91 +};
1.92 +
1.93 +template<>
1.94 +struct if_impl<false>
1.95 +{
1.96 + template< typename T1, typename T2 > struct result_
1.97 + {
1.98 + typedef T2 type;
1.99 + };
1.100 +};
1.101 +
1.102 +} // namespace aux
1.103 +
1.104 +template<
1.105 + bool C_
1.106 + , typename T1
1.107 + , typename T2
1.108 + >
1.109 +struct if_c
1.110 +{
1.111 + typedef typename aux::if_impl< C_ >
1.112 + ::template result_<T1,T2>::type type;
1.113 +};
1.114 +
1.115 +// (almost) copy & paste in order to save one more
1.116 +// recursively nested template instantiation to user
1.117 +template<
1.118 + typename BOOST_MPL_AUX_NA_PARAM(C_)
1.119 + , typename BOOST_MPL_AUX_NA_PARAM(T1)
1.120 + , typename BOOST_MPL_AUX_NA_PARAM(T2)
1.121 + >
1.122 +struct if_
1.123 +{
1.124 + enum { msvc_wknd_ = BOOST_MPL_AUX_MSVC_VALUE_WKND(C_)::value };
1.125 +
1.126 + typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, msvc_wknd_) >
1.127 + ::template result_<T1,T2>::type type;
1.128 +
1.129 + BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2))
1.130 +};
1.131 +
1.132 +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.133 +
1.134 +BOOST_MPL_AUX_NA_SPEC(3, if_)
1.135 +
1.136 +}}
1.137 +
1.138 +#endif // BOOST_MPL_IF_HPP_INCLUDED