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