1 2 // (C) Copyright Edward Diener 2011,2012,2013 3 // Use, modification and distribution are subject to the Boost Software License, 4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt). 6 7 #if !defined(BOOST_TTI_DETAIL_MEM_TYPE_HPP) 8 #define BOOST_TTI_DETAIL_MEM_TYPE_HPP 9 10 #include <boost/config.hpp> 11 #include <boost/mpl/bool.hpp> 12 #include <boost/mpl/eval_if.hpp> 13 #include <boost/mpl/has_xxx.hpp> 14 #include <boost/preprocessor/cat.hpp> 15 #include <boost/tti/detail/denclosing_type.hpp> 16 #include <boost/tti/gen/namespace_gen.hpp> 17 18 #define BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_MEMBER_TYPE_OP(trait,name) \ 19 BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(BOOST_PP_CAT(trait,_detail_member_type_mpl), name, false) \ 20 template<class BOOST_TTI_DETAIL_TP_T> \ 21 struct BOOST_PP_CAT(trait,_detail_member_type_op) : \ 22 BOOST_PP_CAT(trait,_detail_member_type_mpl)<BOOST_TTI_DETAIL_TP_T> \ 23 { \ 24 }; \ 25 /**/ 26 27 #define BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_MEMBER_TYPE(trait,name) \ 28 BOOST_TTI_DETAIL_TRAIT_HAS_TYPE_MEMBER_TYPE_OP(trait,name) \ 29 template<class BOOST_TTI_DETAIL_TP_T> \ 30 struct BOOST_PP_CAT(trait,_detail_has_type_member_type) \ 31 { \ 32 typedef typename \ 33 boost::mpl::eval_if \ 34 < \ 35 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \ 36 BOOST_PP_CAT(trait,_detail_member_type_op)<BOOST_TTI_DETAIL_TP_T>, \ 37 boost::mpl::false_ \ 38 >::type type; \ 39 \ 40 BOOST_STATIC_CONSTANT(bool,value=type::value); \ 41 }; \ 42 /**/ 43 44 #define BOOST_TTI_DETAIL_TRAIT_MEMBER_TYPE(trait,name) \ 45 template<class BOOST_TTI_DETAIL_TP_T> \ 46 struct BOOST_PP_CAT(trait,_detail_member_type) \ 47 { \ 48 typedef typename BOOST_TTI_DETAIL_TP_T::name type; \ 49 }; \ 50 /**/ 51 52 #endif // BOOST_TTI_DETAIL_MEM_TYPE_HPP 53