has_static_member_data.hpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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_HAS_STATIC_MEMBER_DATA_HPP)
  6. #define BOOST_TTI_HAS_STATIC_MEMBER_DATA_HPP
  7. #include <boost/config.hpp>
  8. #include <boost/preprocessor/cat.hpp>
  9. #include <boost/tti/gen/has_static_member_data_gen.hpp>
  10. #include <boost/tti/detail/dstatic_mem_data.hpp>
  11. /*
  12. The succeeding comments in this file are in doxygen format.
  13. */
  14. /** \file
  15. */
  16. /// Expands to a metafunction which tests whether a static member data with a particular name and type exists.
  17. /**
  18. trait = the name of the metafunction within the tti namespace.
  19. name = the name of the inner member.
  20. generates a metafunction called "trait" where 'trait' is the macro parameter.
  21. The metafunction types and return:
  22. BOOST_TTI_TP_T = the enclosing type.
  23. BOOST_TTI_TP_TYPE = the static member data type,
  24. in the form of a data type,
  25. in which to look for our 'name'.
  26. returns = 'value' is true if the 'name' exists,
  27. with the BOOST_TTI_TP_TYPE type,
  28. within the enclosing BOOST_TTI_TP_T type,
  29. otherwise 'value' is false.
  30. */
  31. #define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA(trait,name) \
  32. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_DATA(trait,name) \
  33. template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> \
  34. struct trait : \
  35. BOOST_PP_CAT(trait,_detail_hsd)<BOOST_TTI_TP_T,BOOST_TTI_TP_TYPE> \
  36. { \
  37. }; \
  38. /**/
  39. /// Expands to a metafunction which tests whether a static member data with a particular name and type exists.
  40. /**
  41. name = the name of the inner member.
  42. generates a metafunction called "has_static_member_data_name" where 'name' is the macro parameter.
  43. The metafunction types and return:
  44. BOOST_TTI_TP_T = the enclosing type.
  45. BOOST_TTI_TP_TYPE = the static member data type,
  46. in the form of a data type,
  47. in which to look for our 'name'.
  48. returns = 'value' is true if the 'name' exists,
  49. with the appropriate BOOST_TTI_TP_TYPE type,
  50. within the enclosing BOOST_TTI_TP_T type,
  51. otherwise 'value' is false.
  52. */
  53. #define BOOST_TTI_HAS_STATIC_MEMBER_DATA(name) \
  54. BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA \
  55. ( \
  56. BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(name), \
  57. name \
  58. ) \
  59. /**/
  60. #endif // BOOST_TTI_HAS_STATIC_MEMBER_DATA_HPP