File indexing completed on 2025-12-16 09:57:25
0001
0002 #if !defined(BOOST_PP_IS_ITERATING)
0003
0004
0005
0006 #ifndef BOOST_MPL_INHERIT_HPP_INCLUDED
0007 #define BOOST_MPL_INHERIT_HPP_INCLUDED
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
0022 # include <boost/mpl/empty_base.hpp>
0023 # include <boost/mpl/aux_/na_spec.hpp>
0024 # include <boost/mpl/aux_/lambda_support.hpp>
0025 #endif
0026
0027 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
0028
0029 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
0030 && !defined(BOOST_MPL_PREPROCESSING_MODE)
0031
0032 # define BOOST_MPL_PREPROCESSED_HEADER inherit.hpp
0033 # include <boost/mpl/aux_/include_preprocessed.hpp>
0034
0035 #else
0036
0037 # include <boost/mpl/limits/arity.hpp>
0038 # include <boost/mpl/aux_/preprocessor/params.hpp>
0039 # include <boost/mpl/aux_/preprocessor/default_params.hpp>
0040 # include <boost/mpl/aux_/preprocessor/enum.hpp>
0041 # include <boost/mpl/aux_/config/ctps.hpp>
0042 # include <boost/mpl/aux_/config/dtp.hpp>
0043
0044 # include <boost/preprocessor/iterate.hpp>
0045 # include <boost/preprocessor/dec.hpp>
0046 # include <boost/preprocessor/cat.hpp>
0047
0048 namespace boost { namespace mpl {
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0064
0065 template<
0066 typename BOOST_MPL_AUX_NA_PARAM(T1)
0067 , typename BOOST_MPL_AUX_NA_PARAM(T2)
0068 >
0069 struct inherit2
0070 : T1, T2
0071 {
0072 typedef inherit2 type;
0073 BOOST_MPL_AUX_LAMBDA_SUPPORT(2, inherit2, (T1,T2))
0074 };
0075
0076 template< typename T1 >
0077 struct inherit2<T1,empty_base>
0078 {
0079 typedef T1 type;
0080 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (T1,empty_base))
0081 };
0082
0083 template< typename T2 >
0084 struct inherit2<empty_base,T2>
0085 {
0086 typedef T2 type;
0087 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base,T2))
0088 };
0089
0090
0091
0092 template<>
0093 struct inherit2<empty_base,empty_base>
0094 {
0095 typedef empty_base type;
0096 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base,empty_base))
0097 };
0098
0099 #else
0100
0101 namespace aux {
0102
0103 template< bool C1, bool C2 >
0104 struct inherit2_impl
0105 {
0106 template< typename Derived, typename T1, typename T2 > struct result_
0107 : T1, T2
0108 {
0109 typedef Derived type_;
0110 };
0111 };
0112
0113 template<>
0114 struct inherit2_impl<false,true>
0115 {
0116 template< typename Derived, typename T1, typename T2 > struct result_
0117 : T1
0118 {
0119 typedef T1 type_;
0120 };
0121 };
0122
0123 template<>
0124 struct inherit2_impl<true,false>
0125 {
0126 template< typename Derived, typename T1, typename T2 > struct result_
0127 : T2
0128 {
0129 typedef T2 type_;
0130 };
0131 };
0132
0133 template<>
0134 struct inherit2_impl<true,true>
0135 {
0136 template< typename Derived, typename T1, typename T2 > struct result_
0137 {
0138 typedef T1 type_;
0139 };
0140 };
0141
0142 }
0143
0144 template<
0145 typename BOOST_MPL_AUX_NA_PARAM(T1)
0146 , typename BOOST_MPL_AUX_NA_PARAM(T2)
0147 >
0148 struct inherit2
0149 : aux::inherit2_impl<
0150 is_empty_base<T1>::value
0151 , is_empty_base<T2>::value
0152 >::template result_< inherit2<T1,T2>,T1,T2 >
0153 {
0154 typedef typename inherit2::type_ type;
0155 BOOST_MPL_AUX_LAMBDA_SUPPORT(2, inherit2, (T1,T2))
0156 };
0157
0158 #endif
0159
0160 BOOST_MPL_AUX_NA_SPEC(2, inherit2)
0161
0162 #define BOOST_PP_ITERATION_PARAMS_1 \
0163 (3,(3, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/inherit.hpp>))
0164 #include BOOST_PP_ITERATE()
0165
0166 }}
0167
0168 #endif
0169 #endif
0170
0171
0172
0173 #else
0174 #define n_ BOOST_PP_FRAME_ITERATION(1)
0175
0176 template<
0177 BOOST_MPL_PP_DEFAULT_PARAMS(n_, typename T, na)
0178 >
0179 struct BOOST_PP_CAT(inherit,n_)
0180 : inherit2<
0181 typename BOOST_PP_CAT(inherit,BOOST_PP_DEC(n_))<
0182 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(n_), T)
0183 >::type
0184 , BOOST_PP_CAT(T,n_)
0185 >
0186 {
0187 BOOST_MPL_AUX_LAMBDA_SUPPORT(
0188 n_
0189 , BOOST_PP_CAT(inherit,n_)
0190 , (BOOST_MPL_PP_PARAMS(n_, T))
0191 )
0192 };
0193
0194 BOOST_MPL_AUX_NA_SPEC(n_, BOOST_PP_CAT(inherit,n_))
0195
0196 #if n_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
0197
0198 template<
0199 BOOST_MPL_PP_DEFAULT_PARAMS(n_, typename T, empty_base)
0200 >
0201 struct inherit
0202 : BOOST_PP_CAT(inherit,n_)<BOOST_MPL_PP_PARAMS(n_, T)>
0203 {
0204 };
0205
0206
0207 template<>
0208 struct inherit< BOOST_MPL_PP_ENUM(5, na) >
0209 {
0210 template<
0211 #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
0212 BOOST_MPL_PP_DEFAULT_PARAMS(n_, typename T, empty_base)
0213 #else
0214 BOOST_MPL_PP_PARAMS(n_, typename T)
0215 #endif
0216 >
0217 struct apply
0218 : inherit< BOOST_MPL_PP_PARAMS(n_, T) >
0219 {
0220 };
0221 };
0222
0223 BOOST_MPL_AUX_NA_SPEC_LAMBDA(n_, inherit)
0224 BOOST_MPL_AUX_NA_SPEC_ARITY(n_, inherit)
0225 BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(n_, n_, inherit)
0226 #endif
0227
0228 #undef n_
0229 #endif