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 /// A macro which expands to a metafunction which tests whether member data with a particular name and type exists.
28 BOOST_TTI_TRAIT_HAS_MEMBER_DATA is a macro which expands to a metafunction.
29 The metafunction tests whether member data with a particular
30 name and type exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_MEMBER_DATA(trait,name) where
32 trait = the name of the metafunction. <br/>
33 name = the name of the inner member data.
35 BOOST_TTI_TRAIT_HAS_MEMBER_DATA generates a metafunction called "trait" where 'trait' is the macro parameter.
39 template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE>
42 static const value = unspecified;
43 typedef mpl::bool_<true-or-false> type;
46 The metafunction types and return:
48 BOOST_TTI_TP_ET = the enclosing type in which to look for our 'name'
49 The enclosing type can be a class, struct, or union.
51 The type of the member data in the form of a pointer
54 BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first
55 parameter is the enclosing type.
57 returns = 'value' is true if the 'name' exists, with the correct data type,
58 otherwise 'value' is false.
63 #define BOOST_TTI_TRAIT_HAS_MEMBER_DATA(trait,name) \
64 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \
65 template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE = BOOST_TTI_NAMESPACE::detail::deftype> \
69 BOOST_PP_CAT(trait,_detail_hmd) \
74 BOOST_STATIC_CONSTANT(bool,value=type::value); \
78 /// A macro which expands to a metafunction which tests whether a member data with a particular name and type exists.
81 BOOST_TTI_HAS_MEMBER_DATA is a macro which expands to a metafunction.
82 The metafunction tests whether member data with a particular
83 name and type exists. The macro takes the form of BOOST_TTI_HAS_MEMBER_DATA(name) where
85 name = the name of the inner member.
87 BOOST_TTI_HAS_MEMBER_DATA generates a metafunction called "has_member_data_name" where 'name' is the macro parameter.
91 template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE>
92 struct has_member_data_'name'
94 static const value = unspecified;
95 typedef mpl::bool_<true-or-false> type;
98 The metafunction types and return:
100 BOOST_TTI_TP_ET = the enclosing type in which to look for our 'name'.
101 The enclosing type can be a class, struct, or union.
103 The type of the member data in the form of a pointer
106 BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first
107 parameter is the enclosing type.
109 returns = 'value' is true if the 'name' exists, with the correct data type,
110 otherwise 'value' is false.
115 #define BOOST_TTI_HAS_MEMBER_DATA(name) \
116 BOOST_TTI_TRAIT_HAS_MEMBER_DATA \
118 BOOST_TTI_HAS_MEMBER_DATA_GEN(name), \
123 #endif // BOOST_TTI_HAS_MEMBER_DATA_HPP