File indexing completed on 2025-01-18 09:52:54
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_TTI_DETAIL_TEMPLATE_HPP)
0008 #define BOOST_TTI_DETAIL_TEMPLATE_HPP
0009
0010 #include <boost/config.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/preprocessor/debug/assert.hpp>
0016 #include <boost/preprocessor/facilities/is_empty.hpp>
0017 #include <boost/tti/detail/denclosing_type.hpp>
0018 #include <boost/tti/gen/namespace_gen.hpp>
0019 #include <boost/type_traits/is_class.hpp>
0020 #include <boost/type_traits/is_union.hpp>
0021
0022 #define BOOST_TTI_DETAIL_IS_HELPER_BOOST_PP_NIL
0023
0024 #define BOOST_TTI_DETAIL_IS_NIL(param) \
0025 BOOST_PP_IS_EMPTY \
0026 ( \
0027 BOOST_PP_CAT(BOOST_TTI_DETAIL_IS_HELPER_,param) \
0028 ) \
0029
0030
0031 #define BOOST_TTI_DETAIL_TRAIT_ASSERT_NOT_NIL(trait,name,params) \
0032 BOOST_PP_ASSERT_MSG(0, "The parameter must be BOOST_PP_NIL") \
0033
0034
0035 #define BOOST_TTI_DETAIL_TRAIT_CHECK_IS_NIL(trait,name,params) \
0036 BOOST_PP_IIF \
0037 ( \
0038 BOOST_TTI_DETAIL_IS_NIL(params), \
0039 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE, \
0040 BOOST_TTI_DETAIL_TRAIT_ASSERT_NOT_NIL \
0041 ) \
0042 (trait,name,params) \
0043
0044
0045 #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_THT(trait,name) \
0046 BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(BOOST_PP_CAT(trait,_detail_mpl), name, false) \
0047 template<class BOOST_TTI_DETAIL_TP_T> \
0048 struct BOOST_PP_CAT(trait,_tht) : \
0049 BOOST_PP_CAT(trait,_detail_mpl)<BOOST_TTI_DETAIL_TP_T> \
0050 { \
0051 }; \
0052
0053
0054 #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE(trait,name,params) \
0055 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_THT(trait,name) \
0056 template<class BOOST_TTI_DETAIL_TP_T> \
0057 struct trait \
0058 { \
0059 typedef typename \
0060 boost::mpl::eval_if \
0061 < \
0062 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
0063 BOOST_PP_CAT(trait,_tht)<BOOST_TTI_DETAIL_TP_T>, \
0064 boost::mpl::false_ \
0065 >::type type; \
0066 BOOST_STATIC_CONSTANT(bool,value=type::value); \
0067 }; \
0068
0069
0070 #endif