File indexing completed on 2025-12-15 09:57:29
0001
0002 #ifndef BOOST_MPL_IF_HPP_INCLUDED
0003 #define BOOST_MPL_IF_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/aux_/value_wknd.hpp>
0018 #include <boost/mpl/aux_/static_cast.hpp>
0019 #include <boost/mpl/aux_/na_spec.hpp>
0020 #include <boost/mpl/aux_/lambda_support.hpp>
0021 #include <boost/mpl/aux_/config/integral.hpp>
0022 #include <boost/mpl/aux_/config/ctps.hpp>
0023 #include <boost/mpl/aux_/config/workaround.hpp>
0024
0025 namespace boost { namespace mpl {
0026
0027 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0028
0029 template<
0030 bool C
0031 , typename T1
0032 , typename T2
0033 >
0034 struct if_c
0035 {
0036 typedef T1 type;
0037 };
0038
0039 template<
0040 typename T1
0041 , typename T2
0042 >
0043 struct if_c<false,T1,T2>
0044 {
0045 typedef T2 type;
0046 };
0047
0048
0049
0050 template<
0051 typename BOOST_MPL_AUX_NA_PARAM(T1)
0052 , typename BOOST_MPL_AUX_NA_PARAM(T2)
0053 , typename BOOST_MPL_AUX_NA_PARAM(T3)
0054 >
0055 struct if_
0056 {
0057 private:
0058
0059 typedef if_c<
0060 #if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS)
0061 BOOST_MPL_AUX_VALUE_WKND(T1)::value
0062 #else
0063 BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
0064 #endif
0065 , T2
0066 , T3
0067 > almost_type_;
0068
0069 public:
0070 typedef typename almost_type_::type type;
0071
0072 BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(T1,T2,T3))
0073 };
0074
0075 #else
0076
0077
0078
0079 namespace aux {
0080
0081 template< bool C >
0082 struct if_impl
0083 {
0084 template< typename T1, typename T2 > struct result_
0085 {
0086 typedef T1 type;
0087 };
0088 };
0089
0090 template<>
0091 struct if_impl<false>
0092 {
0093 template< typename T1, typename T2 > struct result_
0094 {
0095 typedef T2 type;
0096 };
0097 };
0098
0099 }
0100
0101 template<
0102 bool C_
0103 , typename T1
0104 , typename T2
0105 >
0106 struct if_c
0107 {
0108 typedef typename aux::if_impl< C_ >
0109 ::template result_<T1,T2>::type type;
0110 };
0111
0112
0113
0114 template<
0115 typename BOOST_MPL_AUX_NA_PARAM(C_)
0116 , typename BOOST_MPL_AUX_NA_PARAM(T1)
0117 , typename BOOST_MPL_AUX_NA_PARAM(T2)
0118 >
0119 struct if_
0120 {
0121 enum { msvc_wknd_ = BOOST_MPL_AUX_MSVC_VALUE_WKND(C_)::value };
0122
0123 typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, msvc_wknd_) >
0124 ::template result_<T1,T2>::type type;
0125
0126 BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2))
0127 };
0128
0129 #endif
0130
0131 BOOST_MPL_AUX_NA_SPEC(3, if_)
0132
0133 }}
0134
0135 #endif