File indexing completed on 2025-01-18 09:52:54
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_TTI_DETAIL_TYPE_HPP)
0008 #define BOOST_TTI_DETAIL_TYPE_HPP
0009
0010 #include <boost/mpl/apply.hpp>
0011 #include <boost/mpl/bool.hpp>
0012 #include <boost/mpl/eval_if.hpp>
0013 #include <boost/mpl/has_xxx.hpp>
0014 #include <boost/preprocessor/cat.hpp>
0015 #include <boost/tti/detail/ddeftype.hpp>
0016 #include <boost/tti/detail/dlambda.hpp>
0017 #include <boost/tti/detail/denclosing_type.hpp>
0018 #include <boost/tti/gen/namespace_gen.hpp>
0019
0020 #define BOOST_TTI_DETAIL_TRAIT_INVOKE_HAS_TYPE(trait,name) \
0021 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_MFC> \
0022 struct BOOST_PP_CAT(trait,_detail_type_invoke) : \
0023 boost::mpl::apply<BOOST_TTI_DETAIL_TP_MFC,typename BOOST_TTI_DETAIL_TP_T::name> \
0024 { \
0025 }; \
0026
0027
0028 #define BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_OP_CHOOSE(trait,name) \
0029 BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(BOOST_PP_CAT(trait,_detail_type_mpl), name, false) \
0030 BOOST_TTI_DETAIL_TRAIT_INVOKE_HAS_TYPE(trait,name) \
0031 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U,class BOOST_TTI_DETAIL_TP_B> \
0032 struct BOOST_PP_CAT(trait,_detail_type_op_choose) \
0033 { \
0034 BOOST_MPL_ASSERT((BOOST_TTI_NAMESPACE::detail::is_lambda_expression<BOOST_TTI_DETAIL_TP_U>)); \
0035 typedef typename BOOST_PP_CAT(trait,_detail_type_invoke)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_U>::type type; \
0036 }; \
0037 \
0038 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U> \
0039 struct BOOST_PP_CAT(trait,_detail_type_op_choose)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_U,boost::mpl::false_::type> : \
0040 boost::mpl::false_ \
0041 { \
0042 }; \
0043 \
0044 template<class BOOST_TTI_DETAIL_TP_T> \
0045 struct BOOST_PP_CAT(trait,_detail_type_op_choose)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_NAMESPACE::detail::deftype,boost::mpl::true_::type> : \
0046 boost::mpl::true_ \
0047 { \
0048 }; \
0049
0050
0051 #define BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_OP(trait,name) \
0052 BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_OP_CHOOSE(trait,name) \
0053 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U> \
0054 struct BOOST_PP_CAT(trait,_detail_type_op) : \
0055 BOOST_PP_CAT(trait,_detail_type_op_choose) \
0056 < \
0057 BOOST_TTI_DETAIL_TP_T, \
0058 BOOST_TTI_DETAIL_TP_U, \
0059 typename BOOST_PP_CAT(trait,_detail_type_mpl)<BOOST_TTI_DETAIL_TP_T>::type \
0060 > \
0061 { \
0062 }; \
0063
0064
0065 #define BOOST_TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
0066 BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_OP(trait,name) \
0067 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U> \
0068 struct BOOST_PP_CAT(trait,_detail_type) : \
0069 boost::mpl::eval_if \
0070 < \
0071 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
0072 BOOST_PP_CAT(trait,_detail_type_op)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_U>, \
0073 boost::mpl::false_ \
0074 > \
0075 { \
0076 }; \
0077
0078
0079 #endif