2 // (C) Copyright Edward Diener 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_HAS_DATA_HPP)
8 #define BOOST_TTI_HAS_DATA_HPP
10 #include <boost/config.hpp>
11 #include <boost/preprocessor/cat.hpp>
12 #include <boost/type_traits/remove_const.hpp>
13 #include <boost/tti/gen/has_data_gen.hpp>
14 #include <boost/tti/detail/ddata.hpp>
18 The succeeding comments in this file are in doxygen format.
25 /// Expands to a metafunction which tests whether member data or static member with a particular name and type exists.
28 trait = the name of the metafunction.
30 name = the name of the inner member to introspect.
32 generates a metafunction called "trait" where 'trait' is the macro parameter.
34 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE>
37 static const value = unspecified;
38 typedef mpl::bool_<true-or-false> type;
41 The metafunction types and return:
43 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
45 BOOST_TTI_TP_TYPE = The type of the member data or static member.
47 returns = 'value' is true if the 'name' exists, with the correct data type,
48 otherwise 'value' is false.
51 #define BOOST_TTI_TRAIT_HAS_DATA(trait,name) \
52 BOOST_TTI_DETAIL_TRAIT_HAS_DATA(trait,name) \
53 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> \
57 BOOST_PP_CAT(trait,_detail_hd) \
59 typename boost::remove_const<BOOST_TTI_TP_T>::type, \
62 BOOST_STATIC_CONSTANT(bool,value=type::value); \
66 /// Expands to a metafunction which tests whether member data or static member data with a particular name and type exists.
69 name = the name of the inner member.
71 generates a metafunction called "has_data_name" where 'name' is the macro parameter.
73 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE>
76 static const value = unspecified;
77 typedef mpl::bool_<true-or-false> type;
80 The metafunction types and return:
82 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
84 BOOST_TTI_TP_TYPE = The type of the member data or static member.
86 returns = 'value' is true if the 'name' exists, with the correct data type,
87 otherwise 'value' is false.
90 #define BOOST_TTI_HAS_DATA(name) \
91 BOOST_TTI_TRAIT_HAS_DATA \
93 BOOST_TTI_HAS_DATA_GEN(name), \
98 #endif // BOOST_TTI_HAS_DATA_HPP