Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:55

0001 
0002 //  (C) Copyright Edward Diener 2019
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_MEMBER_FUNCTION_TEMPLATE_HPP)
0008 #define BOOST_TTI_MEMBER_FUNCTION_TEMPLATE_HPP
0009 
0010 #include <boost/config.hpp>
0011 #include <boost/function_types/property_tags.hpp>
0012 #include <boost/mpl/vector.hpp>
0013 #include <boost/preprocessor/cat.hpp>
0014 #include <boost/tti/detail/ddeftype.hpp>
0015 #include <boost/tti/detail/dmem_fun_template.hpp>
0016 #include <boost/tti/gen/has_member_function_template_gen.hpp>
0017 #include <boost/tti/gen/namespace_gen.hpp>
0018 
0019 #if BOOST_PP_VARIADICS
0020 
0021 #include <boost/tti/detail/dmacro_fun_template.hpp>
0022 
0023 /*
0024 
0025   The succeeding comments in this file are in doxygen format.
0026 
0027 */
0028 
0029 /** \file
0030 */
0031 
0032 /// A macro which expands to a metafunction which tests whether an inner member function template with a particular name exists.
0033 /**
0034 
0035     BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction.
0036     The metafunction tests whether an inner member function template with a particular name exists.
0037     The macro takes the form of BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,...) where
0038     
0039     trait = the name of the metafunction <br/>
0040     name  = inner member function template name <br/>
0041     ...   = variadic parameters.
0042     
0043     The variadic parameter(s) are either:
0044     
0045     A sequence of valid instantiations for the member function template parameters
0046     ie. 'int,long,double' etc.
0047         
0048     or
0049     
0050     A single variadic parameter which is a Boost PP array whose elements are
0051     a sequence of valid instantiations for the member function template parameters
0052     ie. '(3,(int,long,double))' etc. This form is allowed in order to be compatible
0053     with using the non-variadic form of this macro.
0054     
0055     BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "trait" where 'trait' is the first macro parameter.
0056     
0057   @code
0058   
0059             template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
0060             struct trait
0061               {
0062               static const value = unspecified;
0063               typedef mpl::bool_<true-or-false> type;
0064               };
0065       
0066             The metafunction types and return:
0067       
0068               BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0069                                  The enclosing type can be a class, struct, or union.
0070                                           OR
0071                                  a pointer to member function as a single type
0072                                  which encapsulates a single instantiation of
0073                                  the member function template.
0074               
0075               BOOST_TTI_TP_R   = (optional) the return type of the member function template
0076                         in a single instantiation of the member function template
0077                         if the first parameter is the enclosing type.
0078               
0079               BOOST_TTI_TP_FS  = (optional) the parameters of the member function template as a boost::mpl forward sequence
0080                         if the first parameter is the enclosing type and the member function template parameters
0081                         are not empty. These parameters are a single instantiation of the member function template.
0082               
0083               BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function template
0084                         if the first parameter is the enclosing type and a tag is needed.
0085               
0086               returns = 'value' is true if the 'name' exists, 
0087                         with the appropriate member function template type,
0088                         otherwise 'value' is false.
0089                           
0090   @endcode
0091   
0092 */
0093 #define BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,...) \
0094   BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
0095     ( \
0096     trait, \
0097     name, \
0098     BOOST_TTI_DETAIL_FUN_TEMPLATE_VARIADIC_TO_ARRAY(__VA_ARGS__) \
0099     ) \
0100   template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R = BOOST_TTI_NAMESPACE::detail::deftype,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
0101   struct trait \
0102     { \
0103     typedef typename \
0104     BOOST_PP_CAT(trait,_detail_hmft)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
0105     BOOST_STATIC_CONSTANT(bool,value=type::value); \
0106     }; \
0107 /**/
0108 
0109 /// A macro which expands to a metafunction which tests whether an inner member function template with a particular name exists.
0110 /**
0111 
0112     BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction.
0113     The metafunction tests whether an inner member function template with a particular name exists.
0114     The macro takes the form of BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,...) where
0115     
0116     name  = inner member function template name <br/>
0117     ...   = variadic parameters.
0118     
0119     The variadic parameter(s) are either:
0120     
0121     A sequence of valid instantiations for the member function template parameters
0122     ie. 'int,long,double' etc.
0123         
0124     or
0125     
0126     A single variadic parameter which is a Boost PP array whose elements are
0127     a sequence of valid instantiations for the member function template parameters
0128     ie. '(3,(int,long,double))' etc. This form is allowed in order to be compatible
0129     with using the non-variadic form of this macro.
0130     
0131     BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "has_member_function_template_'name'" where 'name' is the first macro parameter.
0132     
0133   @code
0134   
0135             template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
0136             struct has_member_function_template_'name'
0137               {
0138               static const value = unspecified;
0139               typedef mpl::bool_<true-or-false> type;
0140               };
0141       
0142             The metafunction types and return:
0143       
0144               BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0145                                  The enclosing type can be a class, struct, or union.
0146                                           OR
0147                                  a pointer to member function as a single type
0148                                  which encapsulates a single instantiation of
0149                                  the member function template.
0150               
0151               BOOST_TTI_TP_R   = (optional) the return type of the member function template
0152                         in a single instantiation of the member function template
0153                         if the first parameter is the enclosing type.
0154               
0155               BOOST_TTI_TP_FS  = (optional) the parameters of the member function template as a boost::mpl forward sequence
0156                         if the first parameter is the enclosing type and the member function template parameters
0157                         are not empty. These parameters are a single instantiation of the member function template.
0158               
0159               BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function template
0160                         if the first parameter is the enclosing type and a tag is needed.
0161               
0162               returns = 'value' is true if the 'name' exists, 
0163                         with the appropriate member function template type,
0164                         otherwise 'value' is false.
0165                           
0166   @endcode
0167   
0168 */
0169 #define BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,...) \
0170   BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
0171   ( \
0172   BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(name), \
0173   name, \
0174   __VA_ARGS__ \
0175   ) \
0176 /**/
0177 
0178 #else // !BOOST_PP_VARIADICS
0179 
0180 /*
0181 
0182   The succeeding comments in this file are in doxygen format.
0183 
0184 */
0185 
0186 /** \file
0187 */
0188 
0189 /// A macro which expands to a metafunction which tests whether an inner member function template with a particular name exists.
0190 /**
0191 
0192     BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction.
0193     The metafunction tests whether an inner member function template with a particular name exists.
0194     The macro takes the form of BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) where
0195     
0196     trait   = the name of the metafunction <br/>
0197     name    = inner member function template name <br/>
0198     pparray = A Boost PP array whose elements are a sequence of valid instantiations for the
0199               member function template parameters ie. '(3,(int,long,double))' etc.
0200     
0201     BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "trait" where 'trait' is the first macro parameter.
0202     
0203   @code
0204   
0205             template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
0206             struct trait
0207               {
0208               static const value = unspecified;
0209               typedef mpl::bool_<true-or-false> type;
0210               };
0211       
0212             The metafunction types and return:
0213       
0214               BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0215                                  The enclosing type can be a class, struct, or union.
0216                                           OR
0217                                  a pointer to member function as a single type
0218                                  which encapsulates a single instantiation of
0219                                  the member function template.
0220               
0221               BOOST_TTI_TP_R   = (optional) the return type of the member function template
0222                         in a single instantiation of the member function template
0223                         if the first parameter is the enclosing type.
0224               
0225               BOOST_TTI_TP_FS  = (optional) the parameters of the member function template as a boost::mpl forward sequence
0226                         if the first parameter is the enclosing type and the member function template parameters
0227                         are not empty. These parameters are a single instantiation of the member function template.
0228               
0229               BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function template
0230                         if the first parameter is the enclosing type and a tag is needed.
0231               
0232               returns = 'value' is true if the 'name' exists, 
0233                         with the appropriate member function template type,
0234                         otherwise 'value' is false.
0235                           
0236   @endcode
0237   
0238 */
0239 #define BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \
0240   BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \
0241   template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R = BOOST_TTI_NAMESPACE::detail::deftype,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
0242   struct trait \
0243     { \
0244     typedef typename \
0245     BOOST_PP_CAT(trait,_detail_hmft)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
0246     BOOST_STATIC_CONSTANT(bool,value=type::value); \
0247     }; \
0248     
0249 /**/
0250 
0251 /// A macro which expands to a metafunction which tests whether an inner member function template with a particular name exists.
0252 /**
0253 
0254     BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction.
0255     The metafunction tests whether an inner member function template with a particular name exists.
0256     The macro takes the form of BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,pparray) where
0257     
0258     name    = inner member function template name <br/>
0259     pparray = A Boost PP array whose elements are a sequence of valid instantiations for the
0260               member function template parameters ie. '(3,(int,long,double))' etc.
0261     
0262     BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "has_member_function_template_'name'" where 'name' is the first macro parameter.
0263     
0264   @code
0265   
0266             template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
0267             struct has_member_function_template_'name'
0268               {
0269               static const value = unspecified;
0270               typedef mpl::bool_<true-or-false> type;
0271               };
0272       
0273             The metafunction types and return:
0274       
0275               BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0276                                  The enclosing type can be a class, struct, or union.
0277                                           OR
0278                                  a pointer to member function as a single type
0279                                  which encapsulates a single instantiation of
0280                                  the member function template.
0281               
0282               BOOST_TTI_TP_R   = (optional) the return type of the member function template
0283                         in a single instantiation of the member function template
0284                         if the first parameter is the enclosing type.
0285               
0286               BOOST_TTI_TP_FS  = (optional) the parameters of the member function template as a boost::mpl forward sequence
0287                         if the first parameter is the enclosing type and the member function template parameters
0288                         are not empty. These parameters are a single instantiation of the member function template.
0289               
0290               BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function template
0291                         if the first parameter is the enclosing type and a tag is needed.
0292               
0293               returns = 'value' is true if the 'name' exists, 
0294                         with the appropriate member function template type,
0295                         otherwise 'value' is false.
0296                           
0297   @endcode
0298   
0299 */
0300 #define BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,pparray) \
0301   BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
0302   ( \
0303   BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(name), \
0304   name, \
0305   pparray \
0306   ) \
0307 /**/
0308 
0309 #endif // BOOST_PP_VARIADICS
0310 
0311 #endif // BOOST_TTI_MEMBER_FUNCTION_TEMPLATE_HPP