dtemplate.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // (C) Copyright Edward Diener 2011,2012,2013
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_TTI_DETAIL_TEMPLATE_HPP)
  6. #define BOOST_TTI_DETAIL_TEMPLATE_HPP
  7. #include <boost/config.hpp>
  8. #include <boost/mpl/has_xxx.hpp>
  9. #include <boost/preprocessor/cat.hpp>
  10. #include <boost/preprocessor/debug/assert.hpp>
  11. #include <boost/preprocessor/facilities/is_empty.hpp>
  12. #define BOOST_TTI_DETAIL_IS_HELPER_BOOST_PP_NIL
  13. #define BOOST_TTI_DETAIL_IS_NIL(param) \
  14. BOOST_PP_IS_EMPTY \
  15. ( \
  16. BOOST_PP_CAT(BOOST_TTI_DETAIL_IS_HELPER_,param) \
  17. ) \
  18. /**/
  19. #define BOOST_TTI_DETAIL_TRAIT_ASSERT_NOT_NIL(trait,name,params) \
  20. BOOST_PP_ASSERT_MSG(0, "The parameter must be BOOST_PP_NIL") \
  21. /**/
  22. #define BOOST_TTI_DETAIL_TRAIT_CHECK_IS_NIL(trait,name,params) \
  23. BOOST_PP_IIF \
  24. ( \
  25. BOOST_TTI_DETAIL_IS_NIL(params), \
  26. BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE, \
  27. BOOST_TTI_DETAIL_TRAIT_ASSERT_NOT_NIL \
  28. ) \
  29. (trait,name,params) \
  30. /**/
  31. #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE(trait,name,params) \
  32. BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(BOOST_PP_CAT(trait,_detail_mpl), name, false) \
  33. template<class BOOST_TTI_DETAIL_TP_T> \
  34. struct trait : \
  35. BOOST_PP_CAT(trait,_detail_mpl)<BOOST_TTI_DETAIL_TP_T> \
  36. { \
  37. }; \
  38. /**/
  39. #endif // !BOOST_TTI_DETAIL_TEMPLATE_HPP