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