• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /// A macro which expands to a metafunction which tests whether a static member data with a particular name and type exists.
25 /**
26 
27     BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA is a macro which expands to a metafunction.
28     The metafunction tests whether static member data with a particular
29     name and type exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA(trait,name) where
30 
31     trait = the name of the metafunction <br/>
32     name  = the name of the inner member.
33 
34     BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA generates a metafunction called "trait" where 'trait' is the macro parameter.
35 
36   @code
37 
38               template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE>
39               struct trait
40                 {
41                 static const value = unspecified;
42                 typedef mpl::bool_<true-or-false> type;
43                 };
44 
45               The metafunction types and return:
46 
47                 BOOST_TTI_TP_T    = the enclosing type.
48                                     The enclosing type can be a class, struct, or union.
49                                     If the type is a union, static member data can only
50                                     be found if the C++11 unrestricted union is implemented
51                                     by the compiler being used, since prior to C++11 a union
52                                     could not have static data members.
53 
54                 BOOST_TTI_TP_TYPE = the type of the static member data.
55 
56                 returns = 'value' is true if the 'name' exists,
57                           with the BOOST_TTI_TP_TYPE type,
58                           within the enclosing BOOST_TTI_TP_T type,
59                           otherwise 'value' is false.
60 
61   @endcode
62 
63 */
64 #define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA(trait,name) \
65   BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_DATA(trait,name) \
66   template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> \
67   struct trait \
68     { \
69     typedef typename \
70     BOOST_PP_CAT(trait,_detail_hsd)<BOOST_TTI_TP_T,BOOST_TTI_TP_TYPE>::type type; \
71     BOOST_STATIC_CONSTANT(bool,value=type::value); \
72     }; \
73 /**/
74 
75 /// A macro which expands to a metafunction which tests whether a static member data with a particular name and type exists.
76 /**
77 
78     BOOST_TTI_HAS_STATIC_MEMBER_DATA is a macro which expands to a metafunction.
79     The metafunction tests whether static member data with a particular
80     name and type exists. The macro takes the form of BOOST_TTI_HAS_STATIC_MEMBER_DATA(name) where
81 
82     name  = the name of the inner member.
83 
84     BOOST_TTI_HAS_STATIC_MEMBER_DATA generates a metafunction called "has_static_member_data_name" where 'name' is the macro parameter.
85 
86   @code
87 
88               template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE>
89               struct has_static_member_data_'name'
90                 {
91                 static const value = unspecified;
92                 typedef mpl::bool_<true-or-false> type;
93                 };
94 
95               The metafunction types and return:
96 
97                 BOOST_TTI_TP_T    = the enclosing type.
98                                     The enclosing type can be a class, struct, or union.
99                                     If the type is a union, static member data can only
100                                     be found if the C++11 unrestricted union is implemented
101                                     by the compiler being used, since prior to C++11 a union
102                                     could not have static data members.
103 
104                 BOOST_TTI_TP_TYPE = the type of the static member data.
105 
106                 returns = 'value' is true if the 'name' exists,
107                           with the appropriate BOOST_TTI_TP_TYPE type,
108                           within the enclosing BOOST_TTI_TP_T type,
109                           otherwise 'value' is false.
110 
111   @endcode
112 
113 */
114 #define BOOST_TTI_HAS_STATIC_MEMBER_DATA(name) \
115   BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA \
116   ( \
117   BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(name), \
118   name \
119   ) \
120 /**/
121 
122 #endif // BOOST_TTI_HAS_STATIC_MEMBER_DATA_HPP
123