|
||||
File indexing completed on 2025-01-18 09:52:55
0001 0002 // (C) Copyright Edward Diener 2012,2013 0003 // Use, modification and distribution are subject to the Boost Software License, 0004 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0005 // http://www.boost.org/LICENSE_1_0.txt). 0006 0007 #if !defined(BOOST_TTI_HAS_DATA_HPP) 0008 #define BOOST_TTI_HAS_DATA_HPP 0009 0010 #include <boost/config.hpp> 0011 #include <boost/preprocessor/cat.hpp> 0012 #include <boost/type_traits/remove_const.hpp> 0013 #include <boost/tti/gen/has_data_gen.hpp> 0014 #include <boost/tti/detail/ddata.hpp> 0015 0016 /* 0017 0018 The succeeding comments in this file are in doxygen format. 0019 0020 */ 0021 0022 /** \file 0023 */ 0024 0025 /// A macro which expands to a metafunction which tests whether member data or static member data with a particular name and type exists. 0026 /** 0027 0028 BOOST_TTI_TRAIT_HAS_DATA is a macro which expands to a metafunction. 0029 The metafunction tests whether member data or static member data with a particular 0030 name and type exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_DATA(trait,name) where 0031 0032 trait = the name of the metafunction <br/> 0033 name = the name of the inner data. 0034 0035 BOOST_TTI_TRAIT_HAS_DATA generates a metafunction called "trait" where 'trait' is the macro parameter. 0036 0037 @code 0038 0039 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> 0040 struct trait 0041 { 0042 static const value = unspecified; 0043 typedef mpl::bool_<true-or-false> type; 0044 }; 0045 0046 The metafunction types and return: 0047 0048 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name' 0049 The enclosing type can be a class, struct, or union. 0050 If the type is a union, static member data can only 0051 be found if the C++11 unrestricted union is implemented 0052 by the compiler being used, since prior to C++11 a union 0053 could not have static data members. 0054 0055 BOOST_TTI_TP_TYPE = The type of the member data or static member. 0056 0057 returns = 'value' is true if the 'name' exists, with the correct data type, 0058 otherwise 'value' is false. 0059 0060 @endcode 0061 0062 */ 0063 #define BOOST_TTI_TRAIT_HAS_DATA(trait,name) \ 0064 BOOST_TTI_DETAIL_TRAIT_HAS_DATA(trait,name) \ 0065 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> \ 0066 struct trait \ 0067 { \ 0068 typedef typename \ 0069 BOOST_PP_CAT(trait,_detail_hd) \ 0070 < \ 0071 typename boost::remove_const<BOOST_TTI_TP_T>::type, \ 0072 BOOST_TTI_TP_TYPE \ 0073 >::type type; \ 0074 BOOST_STATIC_CONSTANT(bool,value=type::value); \ 0075 }; \ 0076 /**/ 0077 0078 /// A macro which expands to a metafunction which tests whether member data or static member data with a particular name and type exists. 0079 /** 0080 0081 BOOST_TTI_HAS_DATA is a macro which expands to a metafunction. 0082 The metafunction tests whether member data or static member data with a particular 0083 name and type exists. The macro takes the form of BOOST_TTI_HAS_DATA(name) where 0084 0085 name = the name of the inner data. 0086 0087 BOOST_TTI_HAS_DATA generates a metafunction called "has_data_name" where 'name' is the macro parameter. 0088 0089 @code 0090 0091 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> 0092 struct has_data_'name' 0093 { 0094 static const value = unspecified; 0095 typedef mpl::bool_<true-or-false> type; 0096 }; 0097 0098 The metafunction types and return: 0099 0100 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name' 0101 The enclosing type can be a class, struct, or union. 0102 If the type is a union, static member data can only 0103 be found if the C++11 unrestricted union is implemented 0104 by the compiler being used, since prior to C++11 a union 0105 could not have static data members. 0106 0107 BOOST_TTI_TP_TYPE = The type of the member data or static member. 0108 0109 returns = 'value' is true if the 'name' exists, with the correct data type, 0110 otherwise 'value' is false. 0111 0112 @endcode 0113 0114 */ 0115 #define BOOST_TTI_HAS_DATA(name) \ 0116 BOOST_TTI_TRAIT_HAS_DATA \ 0117 ( \ 0118 BOOST_TTI_HAS_DATA_GEN(name), \ 0119 name \ 0120 ) \ 0121 /**/ 0122 0123 #endif // BOOST_TTI_HAS_DATA_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |