File indexing completed on 2025-01-18 09:52:54
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_TTI_DETAIL_VM_TEMPLATE_PARAMS_HPP)
0008 #define BOOST_TTI_DETAIL_VM_TEMPLATE_PARAMS_HPP
0009
0010 #include <boost/config.hpp>
0011 #include <boost/preprocessor/config/config.hpp>
0012
0013 #if BOOST_PP_VARIADICS
0014
0015 #include <boost/mpl/eval_if.hpp>
0016 #include <boost/mpl/has_xxx.hpp>
0017 #include <boost/mpl/identity.hpp>
0018 #include <boost/preprocessor/arithmetic/add.hpp>
0019 #include <boost/preprocessor/variadic/size.hpp>
0020 #include <boost/preprocessor/cat.hpp>
0021 #include <boost/preprocessor/comparison/equal.hpp>
0022 #include <boost/preprocessor/control/iif.hpp>
0023 #include <boost/preprocessor/detail/is_binary.hpp>
0024 #include <boost/preprocessor/facilities/is_empty.hpp>
0025 #include <boost/preprocessor/seq/enum.hpp>
0026 #include <boost/preprocessor/seq/seq.hpp>
0027 #include <boost/preprocessor/variadic/elem.hpp>
0028 #include <boost/preprocessor/variadic/to_seq.hpp>
0029 #include <boost/tti/detail/dtemplate.hpp>
0030 #include <boost/tti/detail/dtemplate_params.hpp>
0031 #include <boost/tti/detail/denclosing_type.hpp>
0032 #include <boost/tti/gen/namespace_gen.hpp>
0033
0034 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
0035 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
0036
0037 #define BOOST_TTI_DETAIL_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
0038 BOOST_TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
0039 ( \
0040 ( BOOST_PP_ADD(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
0041 ) \
0042
0043
0044 #else
0045
0046 #define BOOST_TTI_DETAIL_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
0047 BOOST_TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
0048 ( \
0049 ( BOOST_PP_ADD(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
0050 ) \
0051
0052
0053 #endif
0054 #else
0055
0056 #define BOOST_TTI_DETAIL_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
0057 BOOST_TTI_DETAIL_SAME(trait,name) \
0058
0059
0060 #endif
0061
0062 #define BOOST_TTI_DETAIL_VM_CHECK_MORE_THAN_TWO(trait,...) \
0063 BOOST_PP_IIF \
0064 ( \
0065 BOOST_PP_EQUAL \
0066 ( \
0067 BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
0068 2 \
0069 ), \
0070 BOOST_TTI_DETAIL_VM_TRAIT_CHOOSE_FROM_TWO, \
0071 BOOST_TTI_DETAIL_VM_TRAIT_EXPAND_ARGUMENTS \
0072 ) \
0073 (trait,__VA_ARGS__) \
0074
0075
0076 #define BOOST_TTI_DETAIL_VM_TRAIT_CHOOSE_FROM_TWO(trait,...) \
0077 BOOST_PP_IIF \
0078 ( \
0079 BOOST_PP_IS_BINARY \
0080 ( \
0081 BOOST_PP_VARIADIC_ELEM(1,__VA_ARGS__) \
0082 ), \
0083 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS, \
0084 BOOST_TTI_DETAIL_VM_TRAIT_CHOOSE_IF_NIL \
0085 ) \
0086 ( \
0087 trait, \
0088 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0089 BOOST_PP_VARIADIC_ELEM(1,__VA_ARGS__) \
0090 ) \
0091
0092
0093 #define BOOST_TTI_DETAIL_VM_IS_NIL(param) \
0094 BOOST_PP_IS_EMPTY \
0095 ( \
0096 BOOST_PP_CAT(BOOST_TTI_DETAIL_IS_HELPER_,param) \
0097 ) \
0098
0099
0100 #define BOOST_TTI_DETAIL_VM_TRAIT_CHOOSE_IF_NIL(trait,name,param) \
0101 BOOST_PP_IIF \
0102 ( \
0103 BOOST_TTI_DETAIL_VM_IS_NIL(param), \
0104 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE, \
0105 BOOST_TTI_DETAIL_VM_CALL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
0106 ) \
0107 (trait,name,param) \
0108
0109
0110 #define BOOST_TTI_DETAIL_VM_VARIADIC_TAIL(...) \
0111 BOOST_PP_SEQ_ENUM \
0112 ( \
0113 BOOST_PP_SEQ_TAIL \
0114 ( \
0115 BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
0116 ) \
0117 ) \
0118
0119
0120 #define BOOST_TTI_DETAIL_VM_TRAIT_EXPAND_ARGUMENTS(trait,...) \
0121 BOOST_TTI_DETAIL_VM_CALL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
0122 ( \
0123 trait, \
0124 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0125 BOOST_TTI_DETAIL_VM_VARIADIC_TAIL(__VA_ARGS__) \
0126 ) \
0127
0128
0129 #define BOOST_TTI_DETAIL_VM_TRAIT_HAS_TEMPLATE(trait,...) \
0130 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE \
0131 ( \
0132 trait, \
0133 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0134 BOOST_PP_NIL \
0135 ) \
0136
0137
0138 #define BOOST_TTI_DETAIL_VM_CT_INVOKE(trait,name,...) \
0139 BOOST_TTI_DETAIL_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(BOOST_PP_CAT(trait,_detail),name,__VA_ARGS__) \
0140 template<class BOOST_TTI_DETAIL_TP_T> \
0141 struct BOOST_PP_CAT(trait,_detail_vm_ct_invoke) : \
0142 BOOST_PP_CAT(trait,_detail)<BOOST_TTI_DETAIL_TP_T> \
0143 { \
0144 }; \
0145
0146
0147 #define BOOST_TTI_DETAIL_VM_CALL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
0148 BOOST_TTI_DETAIL_VM_CT_INVOKE(trait,name,__VA_ARGS__) \
0149 template<class BOOST_TTI_DETAIL_TP_T> \
0150 struct trait \
0151 { \
0152 typedef typename \
0153 boost::mpl::eval_if \
0154 < \
0155 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
0156 BOOST_PP_CAT(trait,_detail_vm_ct_invoke)<BOOST_TTI_DETAIL_TP_T>, \
0157 boost::mpl::false_ \
0158 >::type type; \
0159 BOOST_STATIC_CONSTANT(bool,value=type::value); \
0160 }; \
0161
0162
0163 #endif
0164
0165 #endif