|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69331 - in sandbox/tti: . boost/tti boost/tti/detail libs/tti/test
From: eldiener_at_[hidden]
Date: 2011-02-27 10:33:43
Author: eldiener
Date: 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
New Revision: 69331
URL: http://svn.boost.org/trac/boost/changeset/69331
Log:
Added function template introspection
Added:
sandbox/tti/boost/tti/detail/dmember_function_template.hpp (contents, props changed)
sandbox/tti/boost/tti/detail/dptmf.hpp (contents, props changed)
sandbox/tti/boost/tti/detail/dstatic_mem_fun_template.hpp (contents, props changed)
sandbox/tti/boost/tti/detail/dtfunction.hpp (contents, props changed)
sandbox/tti/boost/tti/member_function_template.hpp (contents, props changed)
sandbox/tti/boost/tti/mf_member_function_template.hpp (contents, props changed)
sandbox/tti/boost/tti/mf_static_mem_fun_template.hpp (contents, props changed)
sandbox/tti/boost/tti/static_mem_fun_template.hpp (contents, props changed)
sandbox/tti/boost/tti/vm_member_function_template.hpp (contents, props changed)
sandbox/tti/boost/tti/vm_static_mem_fun_template.hpp (contents, props changed)
Text files modified:
sandbox/tti/Jamfile.v2 | 3 +--
sandbox/tti/boost/tti/detail/dmember_function.hpp | 26 +-------------------------
sandbox/tti/boost/tti/detail/dstatic_member_function.hpp | 24 +-----------------------
sandbox/tti/boost/tti/tti.hpp | 2 ++
sandbox/tti/boost/tti/tti_vm.hpp | 2 ++
sandbox/tti/boost/tti/vm_template_params.hpp | 2 --
sandbox/tti/libs/tti/test/Jamfile.v2 | 1 +
7 files changed, 8 insertions(+), 52 deletions(-)
Modified: sandbox/tti/Jamfile.v2
==============================================================================
--- sandbox/tti/Jamfile.v2 (original)
+++ sandbox/tti/Jamfile.v2 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -7,8 +7,7 @@
project tti
: requirements
- <include>.
- <include>$(BOOST_ROOT)
+ <include>.&&$(BOOST_ROOT)
:
build-dir bin.v2
;
\ No newline at end of file
Modified: sandbox/tti/boost/tti/detail/dmember_function.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/dmember_function.hpp (original)
+++ sandbox/tti/boost/tti/detail/dmember_function.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -3,9 +3,8 @@
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
-#include <boost/mpl/push_front.hpp>
-#include <boost/function_types/member_function_pointer.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
+#include "dptmf.hpp"
#if defined(BOOST_NO_NULLPTR)
@@ -51,27 +50,4 @@
#endif // defined(BOOST_NO_NULLPTR)
-namespace boost
- {
- namespace tti
- {
- namespace detail
- {
- template
- <
- class T,
- class R,
- class FS,
- class TAG
- >
- struct ptmf_seq
- {
- typedef typename boost::mpl::push_front<FS,T>::type tfs1;
- typedef typename boost::mpl::push_front<tfs1,R>::type tfs2;
- typedef typename boost::function_types::member_function_pointer<tfs2,TAG>::type type;
- };
- }
- }
- }
-
#endif // TTI_DETAIL_MEMBER_FUNCTION_HPP
Added: sandbox/tti/boost/tti/detail/dmember_function_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/detail/dmember_function_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,54 @@
+#if !defined(TTI_DETAIL_MEMBER_FUNCTION_TEMPLATE_HPP)
+#define TTI_DETAIL_MEMBER_FUNCTION_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+#include <boost/type_traits/detail/yes_no_type.hpp>
+#include "dptmf.hpp"
+
+#if defined(BOOST_NO_NULLPTR)
+
+#define TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ template<class T,class C> \
+ struct trait \
+ { \
+ template<T> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name<BOOST_PP_SEQ_ENUM(tpseq)> > *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<C>(0))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+/**/
+
+#else // !defined(BOOST_NO_NULLPTR)
+
+#define TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ template<class T,class C> \
+ struct trait \
+ { \
+ template<T> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name<BOOST_PP_SEQ_ENUM(tpseq)> > *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<C>(nullptr))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+/**/
+
+#endif // defined(BOOST_NO_NULLPTR)
+
+#endif // TTI_DETAIL_MEMBER_FUNCTION_TEMPLATE_HPP
Added: sandbox/tti/boost/tti/detail/dptmf.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/detail/dptmf.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,31 @@
+#if !defined(TTI_DETAIL_PTMF_HPP)
+#define TTI_DETAIL_PTMF_HPP
+
+#include <boost/config.hpp>
+#include <boost/mpl/push_front.hpp>
+#include <boost/function_types/member_function_pointer.hpp>
+
+namespace boost
+ {
+ namespace tti
+ {
+ namespace detail
+ {
+ template
+ <
+ class T,
+ class R,
+ class FS,
+ class TAG
+ >
+ struct ptmf_seq
+ {
+ typedef typename boost::mpl::push_front<FS,T>::type tfs1;
+ typedef typename boost::mpl::push_front<tfs1,R>::type tfs2;
+ typedef typename boost::function_types::member_function_pointer<tfs2,TAG>::type type;
+ };
+ }
+ }
+ }
+
+#endif // TTI_DETAIL_PTMF_HPP
Added: sandbox/tti/boost/tti/detail/dstatic_mem_fun_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/detail/dstatic_mem_fun_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,54 @@
+#if !defined(TTI_DETAIL_STATIC_MEM_FUN_TEMPLATE_HPP)
+#define TTI_DETAIL_STATIC_MEM_FUN_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+#include <boost/type_traits/detail/yes_no_type.hpp>
+#include "dtfunction.hpp"
+
+#if defined(BOOST_NO_NULLPTR)
+
+#define TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ template<class T,class Type> \
+ struct trait \
+ { \
+ template<Type *> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name<BOOST_PP_SEQ_ENUM(tpseq)> > *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(0))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+/**/
+
+#else // !defined(BOOST_NO_NULLPTR)
+
+#define TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ template<class T,class Type> \
+ struct trait \
+ { \
+ template<Type *> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name<BOOST_PP_SEQ_ENUM(tpseq)> > *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(nullptr))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+/**/
+
+#endif // defined(BOOST_NO_NULLPTR)
+
+#endif // TTI_DETAIL_STATIC_MEM_FUN_TEMPLATE_HPP
Modified: sandbox/tti/boost/tti/detail/dstatic_member_function.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/dstatic_member_function.hpp (original)
+++ sandbox/tti/boost/tti/detail/dstatic_member_function.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -3,9 +3,8 @@
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
-#include <boost/mpl/push_front.hpp>
-#include <boost/function_types/function_type.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
+#include "dtfunction.hpp"
#if defined(BOOST_NO_NULLPTR)
@@ -51,25 +50,4 @@
#endif // defined(BOOST_NO_NULLPTR)
-namespace boost
- {
- namespace tti
- {
- namespace detail
- {
- template
- <
- class R,
- class FS,
- class TAG
- >
- struct tfunction_seq
- {
- typedef typename boost::mpl::push_front<FS,R>::type ftseq;
- typedef typename boost::function_types::function_type<ftseq,TAG>::type type;
- };
- }
- }
- }
-
#endif // TTI_DETAIL_STATIC_MEMBER_FUNCTION_HPP
Added: sandbox/tti/boost/tti/detail/dtfunction.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/detail/dtfunction.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,29 @@
+#if !defined(TTI_DETAIL_TFUNCTION_HPP)
+#define TTI_DETAIL_TFUNCTION_HPP
+
+#include <boost/config.hpp>
+#include <boost/mpl/push_front.hpp>
+#include <boost/function_types/function_type.hpp>
+
+namespace boost
+ {
+ namespace tti
+ {
+ namespace detail
+ {
+ template
+ <
+ class R,
+ class FS,
+ class TAG
+ >
+ struct tfunction_seq
+ {
+ typedef typename boost::mpl::push_front<FS,R>::type ftseq;
+ typedef typename boost::function_types::function_type<ftseq,TAG>::type type;
+ };
+ }
+ }
+ }
+
+#endif // TTI_DETAIL_TFUNCTION_HPP
Added: sandbox/tti/boost/tti/member_function_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/member_function_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,182 @@
+#if !defined(TTI_MEMBER_FUNCTION_TEMPLATE_HPP)
+#define TTI_MEMBER_FUNCTION_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+#include <boost/function_types/property_tags.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include "mf_member_function_template.hpp"
+#include "detail/dmember_function_template.hpp"
+
+/*
+
+ The succeeding comments in this file are in doxygen format.
+
+*/
+
+/** \file
+*/
+
+/// Expands to a metafunction which tests whether a member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction within the tti namespace.
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction called "boost::tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ } \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct trait : \
+ detail::trait<typename detail::ptmf_seq<T,R,FS,TAG>::type,typename boost::remove_const<T>::type> \
+ { \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction class which tests whether a member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction class called "boost::tti::trait" where 'trait' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_MTFC_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ } \
+ struct trait \
+ { \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct apply : \
+ detail::trait<typename detail::ptmf_seq<T,R,FS,TAG>::type,typename boost::remove_const<T>::type> \
+ { \
+ }; \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction which tests whether a member function templaten with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction called "boost::tti::has_member_function_template_name" where 'name' is the macro parameter.
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(name,tpseq) \
+ BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(has_member_function_template_,name), \
+ name, \
+ tpseq \
+ ) \
+/**/
+
+/// Expands to a metafunction class which tests whether a member function template with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction class called "boost::tti::mtfc_has_member_function_template_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_MTFC_HAS_MEMBER_FUNCTION_TEMPLATE(name,tpseq) \
+ BOOST_TTI_MTFC_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(mtfc_has_member_function_template_,name), \
+ name, \
+ tpseq \
+ ) \
+/**/
+
+#endif // TTI_MEMBER_FUNCTION_TEMPLATE_HPP
Added: sandbox/tti/boost/tti/mf_member_function_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/mf_member_function_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,74 @@
+#if !defined(TTI_MF_MEMBER_FUNCTION_TEMPLATE_HPP)
+#define TTI_MF_MEMBER_FUNCTION_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+#include <boost/function_types/property_tags.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/vector.hpp>
+#include "detail/dtself.hpp"
+
+/*
+
+ The succeeding comments in this file are in doxygen format.
+
+*/
+
+/** \file
+*/
+
+namespace boost
+ {
+ namespace tti
+ {
+
+ /// A metafunction which checks whether a member function template exists within an enclosing type.
+ /**
+
+ This metafunction takes its specific types, except for the optional parameters, as nullary metafunctions whose typedef 'type' member is the actual type used.
+
+ The metafunction types and return:
+
+ HasMemberFunctionTemplate = a Boost MPL lambda expression using the metafunction generated from the TTI_HAS_MEMBER_FUNCTION_TEMPLATE ( or TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE ) macro.<br />
+ The easiest way to generate the lambda expression is to use a Boost MPL placeholder expression of the form 'metafunction\<_,_\> ( or optionally 'metafunction\<_,_,_\> or ' 'metafunction\<_,_,_,_\> )'.
+ You can also use the metafunction class generated by the TTI_MTFC_HAS_MEMBER_FUNCTION_TEMPLATE ( or TTI_MTFC_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE ) macro.
+
+ T = the enclosing type as a nullary metafunction.
+
+ R = the return type of the member function as a nullary metafunction.
+
+ FS = an optional parameter which is the parameters of the member function, each as a nullary metafunction, as a boost::mpl forward sequence.<br />
+ This parameter defaults to boost::mpl::vector<>.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the member function.<br />
+ This parameter defaults to boost::function_types::null_tag.
+
+ returns = 'value' is true if the member function exists within the enclosing type,
+ otherwise 'value' is false.
+
+ */
+ template
+ <
+ class HasMemberFunctionTemplate,
+ class T,
+ class R,
+ class FS = boost::mpl::vector<>,
+ class TAG = boost::function_types::null_tag
+ >
+ struct mf_has_member_function_template :
+ boost::mpl::apply
+ <
+ HasMemberFunctionTemplate,
+ typename T::type,
+ typename R::type,
+ typename boost::mpl::transform<FS,detail::tself<boost::mpl::_1> >::type,
+ TAG
+ >::type
+ {
+ };
+ }
+ }
+
+#endif // TTI_MF_MEMBER_FUNCTION_TEMPLATE_HPP
Added: sandbox/tti/boost/tti/mf_static_mem_fun_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/mf_static_mem_fun_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,72 @@
+#if !defined(TTI_MF_STATIC_MEM_FUN_TEMPLATE_HPP)
+#define TTI_MF_STATIC_MEM_FUN_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+#include <boost/function_types/property_tags.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/vector.hpp>
+#include "detail/dtself.hpp"
+
+/*
+
+ The succeeding comments in this file are in doxygen format.
+
+*/
+
+/** \file
+*/
+
+namespace boost
+ {
+ namespace tti
+ {
+
+ /// A metafunction which checks whether a static member function template exists within an enclosing type.
+ /**
+
+ This metafunction takes its specific types, except for the optional parameters, as nullary metafunctions whose typedef 'type' member is the actual type used.
+
+ The metafunction types and return:
+
+ HasStaticMemberFunctionTemplate = a Boost MPL lambda expression using the metafunction generated from the TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE ( or TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE ) macro.<br />
+ The easiest way to generate the lambda expression is to use a Boost MPL placeholder expression of the form 'metafunction\<_,_\> ( or optionally 'metafunction\<_,_,_\> or ' 'metafunction\<_,_,_,_\> )'.
+ You can also use the metafunction class generated by the TTI_MTFC_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE ( or TTI_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE ) macro.
+
+ T = the enclosing type as a nullary metafunction.
+
+ R = the return type of the static member function as a nullary metafunction.
+
+ FS = an optional parameter which is the parameters of the static member function, each as a nullary metafunction, as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the member function exists within the enclosing type,
+ otherwise 'value' is false.
+
+ */
+ template
+ <
+ class HasStaticMemberFunctionTemplate,
+ class T,
+ class R,
+ class FS = boost::mpl::vector<>,
+ class TAG = boost::function_types::null_tag
+ >
+ struct mf_has_static_member_function :
+ boost::mpl::apply
+ <
+ HasStaticMemberFunctionTemplate,
+ typename T::type,
+ typename R::type,
+ typename boost::mpl::transform<FS,detail::tself<boost::mpl::_1> >::type,
+ TAG
+ >::type
+ {
+ };
+ }
+ }
+
+#endif // TTI_MF_STATIC_MEM_FUN_TEMPLATE_HPP
Added: sandbox/tti/boost/tti/static_mem_fun_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/static_mem_fun_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,181 @@
+#if !defined(TTI_STATIC_MEM_FUN_TEMPLATE_HPP)
+#define TTI_STATIC_MEM_FUN_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+#include <boost/function_types/property_tags.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include "mf_static_mem_fun_template.hpp"
+#include "detail/dstatic_mem_fun_template.hpp"
+
+/*
+
+ The succeeding comments in this file are in doxygen format.
+
+*/
+
+/** \file
+*/
+
+/// Expands to a metafunction which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction within the tti namespace.
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction called "boost::tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ } \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct trait : \
+ detail::trait<T,typename detail::tfunction_seq<R,FS,TAG>::type> \
+ { \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction class which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction class called "boost::tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,tpseq) \
+ } \
+ struct trait \
+ { \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct apply : \
+ detail::trait<T,typename detail::tfunction_seq<R,FS,TAG>::type> \
+ { \
+ }; \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction called "boost::tti::has_static_member_function_name" where 'name' is the macro parameter.
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,tpseq) \
+ BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(has_static_member_function_template_,name), \
+ name, \
+ tpseq \
+ ) \
+/**/
+
+/// Expands to a metafunction class which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ tpseq = a Boost PP sequence which has the function template parameters.
+ Each part of the template parameters separated by a comma ( , )
+ is put in a separate sequence element.
+
+ returns = a metafunction class called "boost::tti::mtfc_has_static_member_function_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_MTFC_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,tpseq) \
+ BOOST_TTI_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(mtfc_has_static_member_function_template_,name), \
+ name, \
+ tpseq \
+ ) \
+/**/
+
+#endif // TTI_STATIC_MEM_FUN_TEMPLATE_HPP
Modified: sandbox/tti/boost/tti/tti.hpp
==============================================================================
--- sandbox/tti/boost/tti/tti.hpp (original)
+++ sandbox/tti/boost/tti/tti.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -10,5 +10,7 @@
#include "member_data.hpp"
#include "static_member.hpp"
#include "static_member_function.hpp"
+#include "member_function_template.hpp"
+#include "static_mem_fun_template.hpp"
#endif // TT_INTROSPECTION_HPP
Modified: sandbox/tti/boost/tti/tti_vm.hpp
==============================================================================
--- sandbox/tti/boost/tti/tti_vm.hpp (original)
+++ sandbox/tti/boost/tti/tti_vm.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -2,5 +2,7 @@
#define TT_INTROSPECTION_VM_HPP
#include "vm_template_params.hpp"
+#include "vm_member_function_template.hpp"
+#include "vm_static_mem_fun_template.hpp"
#endif // TT_INTROSPECTION_VM_HPP
Added: sandbox/tti/boost/tti/vm_member_function_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/vm_member_function_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,179 @@
+#if !defined(TTI_VM_MEMBER_FUNCTION_TEMPLATE_HPP)
+#define TTI_VM_MEMBER_FUNCTION_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+
+#if !defined(BOOST_NO_VARIADIC_MACROS)
+
+#include <boost/function_types/property_tags.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/variadic_macro_data/vmd.hpp>
+#include "mf_member_function_template.hpp"
+#include "detail/dmember_function_template.hpp"
+
+/*
+
+ The succeeding comments in this file are in doxygen format.
+
+*/
+
+/** \file
+*/
+
+/// Expands to a metafunction which tests whether a member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction within the tti namespace.
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction called "boost::tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,...) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,BOOST_VMD_DATA_TO_PP_SEQ(__VA_ARGS__)) \
+ } \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct trait : \
+ detail::trait<typename detail::ptmf_seq<T,R,FS,TAG>::type,typename boost::remove_const<T>::type> \
+ { \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction class which tests whether a member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction class called "boost::tti::trait" where 'trait' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_MTFC_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,...) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(trait,name,BOOST_VMD_DATA_TO_PP_SEQ(__VA_ARGS__)) \
+ } \
+ struct trait \
+ { \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct apply : \
+ detail::trait<typename detail::ptmf_seq<T,R,FS,TAG>::type,typename boost::remove_const<T>::type> \
+ { \
+ }; \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction which tests whether a member function templaten with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction called "boost::tti::has_member_function_template_name" where 'name' is the macro parameter.
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_HAS_MEMBER_FUNCTION_TEMPLATE(name,...) \
+ BOOST_TTI_VM_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(has_member_function_template_,name), \
+ name, \
+ __VA_ARGS__ \
+ ) \
+/**/
+
+/// Expands to a metafunction class which tests whether a member function template with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction class called "boost::tti::mtfc_has_member_function_template_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of a valid instantiation of the member function template.
+
+ FS = an optional parameter which are the parameters of a valid instantiation of the member function template, in the form of a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to a valid instantiation of the member function template.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_MTFC_HAS_MEMBER_FUNCTION_TEMPLATE(name,...) \
+ BOOST_TTI_VM_MTFC_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(mtfc_has_member_function_template_,name), \
+ name, \
+ __VA_ARGS__ \
+ ) \
+/**/
+
+#endif // !defined(BOOST_NO_VARIADIC_MACROS)
+#endif // TTI_VM_MEMBER_FUNCTION_TEMPLATE_HPP
Added: sandbox/tti/boost/tti/vm_static_mem_fun_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/vm_static_mem_fun_template.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -0,0 +1,178 @@
+#if !defined(TTI_VM_STATIC_MEM_FUN_TEMPLATE_HPP)
+#define TTI_VM_STATIC_MEM_FUN_TEMPLATE_HPP
+
+#include <boost/config.hpp>
+
+#if !defined(BOOST_NO_VARIADIC_MACROS)
+
+#include <boost/function_types/property_tags.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/variadic_macro_data/vmd.hpp>
+#include "mf_static_mem_fun_template.hpp"
+#include "detail/dstatic_mem_fun_template.hpp"
+
+/*
+
+ The succeeding comments in this file are in doxygen format.
+
+*/
+
+/** \file
+*/
+
+/// Expands to a metafunction which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction within the tti namespace.
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction called "boost::tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,...) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,BOOST_VMD_DATA_TO_PP_SEQ(__VA_ARGS__)) \
+ } \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct trait : \
+ detail::trait<T,typename detail::tfunction_seq<R,FS,TAG>::type> \
+ { \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction class which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction class called "boost::tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,...) \
+namespace boost \
+ { \
+ namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,BOOST_VMD_DATA_TO_PP_SEQ(__VA_ARGS__)) \
+ } \
+ struct trait \
+ { \
+ template<class T,class R,class FS = boost::mpl::vector<>,class TAG = boost::function_types::null_tag> \
+ struct apply : \
+ detail::trait<T,typename detail::tfunction_seq<R,FS,TAG>::type> \
+ { \
+ }; \
+ }; \
+ } \
+ } \
+/**/
+
+/// Expands to a metafunction which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction called "boost::tti::has_static_member_function_name" where 'name' is the macro parameter.
+
+ The metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,...) \
+ BOOST_TTI_VM_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(has_static_member_function_template_,name), \
+ name, \
+ __VA_ARGS__ \
+ ) \
+/**/
+
+/// Expands to a metafunction class which tests whether a static member function template with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ ... = variadic macro data which has the function template parameters.
+
+ returns = a metafunction class called "boost::tti::mtfc_has_static_member_function_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.
+
+ R = the return type of the static member function.
+
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.
+
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.
+
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
+#define BOOST_TTI_VM_MTFC_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,...) \
+ BOOST_TTI_VM_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \
+ ( \
+ BOOST_PP_CAT(mtfc_has_static_member_function_template_,name), \
+ name, \
+ __VA_ARGS__ \
+ ) \
+/**/
+
+#endif // !defined(BOOST_NO_VARIADIC_MACROS)
+#endif // TTI_VM_STATIC_MEM_FUN_TEMPLATE_HPP
Modified: sandbox/tti/boost/tti/vm_template_params.hpp
==============================================================================
--- sandbox/tti/boost/tti/vm_template_params.hpp (original)
+++ sandbox/tti/boost/tti/vm_template_params.hpp 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -5,8 +5,6 @@
#if !defined(BOOST_NO_VARIADIC_MACROS)
-#include <boost/mpl/apply.hpp>
-#include <boost/mpl/identity.hpp>
#include <boost/preprocessor/cat.hpp>
#include "mf_template_params.hpp"
#include "detail/dvm_template_params.hpp"
Modified: sandbox/tti/libs/tti/test/Jamfile.v2
==============================================================================
--- sandbox/tti/libs/tti/test/Jamfile.v2 (original)
+++ sandbox/tti/libs/tti/test/Jamfile.v2 2011-02-27 10:33:41 EST (Sun, 27 Feb 2011)
@@ -116,6 +116,7 @@
[ compile-fail test_mf_has_template_check_params_fail3.cpp ]
[ run test_mf_member_type.cpp ]
[ compile test_mf_member_type_compile.cpp ]
+ [ run test_has_function_template.cpp ]
;
alias ttiVM
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk