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_HAS_MEMBER_DATA_HPP)
8 #define BOOST_TTI_HAS_MEMBER_DATA_HPP
10 #include <boost/config.hpp>
11 #include <boost/preprocessor/cat.hpp>
12 #include <boost/tti/detail/ddeftype.hpp>
13 #include <boost/tti/detail/dmem_data.hpp>
14 #include <boost/tti/gen/has_member_data_gen.hpp>
18 The succeeding comments in this file are in doxygen format.
25 /// Expands to a metafunction which tests whether a member data 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_ET,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_ET = the enclosing type in which to look for our 'name'
45 The type of the member data in the form of a pointer
48 BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first
49 parameter is the enclosing type.
51 returns = 'value' is true if the 'name' exists, with the correct data type,
52 otherwise 'value' is false.
55 #define BOOST_TTI_TRAIT_HAS_MEMBER_DATA(trait,name) \
56 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \
57 template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE = BOOST_TTI_NAMESPACE::detail::deftype> \
61 BOOST_PP_CAT(trait,_detail_hmd) \
66 BOOST_STATIC_CONSTANT(bool,value=type::value); \
70 /// Expands to a metafunction which tests whether a member data with a particular name and type exists.
73 name = the name of the inner member.
75 generates a metafunction called "has_member_data_name" where 'name' is the macro parameter.
77 template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE>
78 struct has_member_data_name
80 static const value = unspecified;
81 typedef mpl::bool_<true-or-false> type;
84 The metafunction types and return:
86 BOOST_TTI_TP_ET = the enclosing type in which to look for our 'name'
88 The type of the member data in the form of a pointer
91 BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first
92 parameter is the enclosing type.
94 returns = 'value' is true if the 'name' exists, with the correct data type,
95 otherwise 'value' is false.
98 #define BOOST_TTI_HAS_MEMBER_DATA(name) \
99 BOOST_TTI_TRAIT_HAS_MEMBER_DATA \
101 BOOST_TTI_HAS_MEMBER_DATA_GEN(name), \
106 #endif // BOOST_TTI_HAS_MEMBER_DATA_HPP