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).
7 #if !defined(BOOST_TTI_DETAIL_TEMPLATE_HPP)
8 #define BOOST_TTI_DETAIL_TEMPLATE_HPP
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/preprocessor/debug/assert.hpp>
16 #include <boost/preprocessor/facilities/is_empty.hpp>
17 #include <boost/type_traits/is_class.hpp>
19 #define BOOST_TTI_DETAIL_IS_HELPER_BOOST_PP_NIL
21 #define BOOST_TTI_DETAIL_IS_NIL(param) \
24 BOOST_PP_CAT(BOOST_TTI_DETAIL_IS_HELPER_,param) \
28 #define BOOST_TTI_DETAIL_TRAIT_ASSERT_NOT_NIL(trait,name,params) \
29 BOOST_PP_ASSERT_MSG(0, "The parameter must be BOOST_PP_NIL") \
32 #define BOOST_TTI_DETAIL_TRAIT_CHECK_IS_NIL(trait,name,params) \
35 BOOST_TTI_DETAIL_IS_NIL(params), \
36 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE, \
37 BOOST_TTI_DETAIL_TRAIT_ASSERT_NOT_NIL \
42 #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_THT(trait,name) \
43 BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(BOOST_PP_CAT(trait,_detail_mpl), name, false) \
44 template<class BOOST_TTI_DETAIL_TP_T> \
45 struct BOOST_PP_CAT(trait,_tht) : \
46 BOOST_PP_CAT(trait,_detail_mpl)<BOOST_TTI_DETAIL_TP_T> \
51 #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE(trait,name,params) \
52 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_THT(trait,name) \
53 template<class BOOST_TTI_DETAIL_TP_T> \
59 boost::is_class<BOOST_TTI_DETAIL_TP_T>, \
60 BOOST_PP_CAT(trait,_tht)<BOOST_TTI_DETAIL_TP_T>, \
63 BOOST_STATIC_CONSTANT(bool,value=type::value); \
67 #endif // !BOOST_TTI_DETAIL_TEMPLATE_HPP