Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68024 - in sandbox/tti/boost/tti: . detail
From: eldiener_at_[hidden]
Date: 2011-01-11 21:48:24


Author: eldiener
Date: 2011-01-11 21:48:20 EST (Tue, 11 Jan 2011)
New Revision: 68024
URL: http://svn.boost.org/trac/boost/changeset/68024

Log:
Added boolean 'valid' to TTI_MEMBER_TYPE and tti::mf_member_type
Text files modified:
   sandbox/tti/boost/tti/TTIntrospection.hpp | 16 +++++++++++++---
   sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp | 17 +++++++++++++++++
   2 files changed, 30 insertions(+), 3 deletions(-)

Modified: sandbox/tti/boost/tti/TTIntrospection.hpp
==============================================================================
--- sandbox/tti/boost/tti/TTIntrospection.hpp (original)
+++ sandbox/tti/boost/tti/TTIntrospection.hpp 2011-01-11 21:48:20 EST (Tue, 11 Jan 2011)
@@ -98,7 +98,9 @@
               
                 T = the enclosing type.<br />
                 returns = 'type' is the inner type of 'name' if the inner type exists
- within the enclosing type, else 'type' is an unspecified type.
+ within the enclosing type, else 'type' is an unspecified type.<br />
+ 'valid' is true if the inner type of 'name' exists
+ within the enclosing type, else 'valid' is false.
                           
     The purpose of this macro is to encapsulate the 'name' type as the typedef 'type'
     of a metafunction, but only if it exists within the enclosing type. This allows for
@@ -125,6 +127,10 @@
         boost::mpl::identity<tti::detail::notype> \
>::type \
     type; \
+ \
+ typedef typename tti::detail::valid_type<type>::type valtype; \
+ \
+ BOOST_STATIC_CONSTANT(bool,valid=valtype::value); \
     }; \
   } \
 /**/
@@ -140,7 +146,9 @@
               
                 T = the enclosing type.<br />
                 returns = 'type' is the inner type of 'name' if the inner type exists
- within the enclosing type, else 'type' is an unspecified type.
+ within the enclosing type, else 'type' is an unspecified type.<br />
+ 'valid' is true if the inner type of 'name' exists
+ within the enclosing type, else 'valid' is false.
                           
     The purpose of this macro is to encapsulate the 'name' type as the typedef 'type'
     of a metafunction, but only if it exists within the enclosing type. This allows for
@@ -1042,7 +1050,9 @@
       
       returns = 'type' is the inner type of the 'name' in TTI_MEMBER_TYPE ( or TTI_TRAIT_MEMBER_TYPE )
                 if the inner type exists within the enclosing type,
- else 'type' is an unspecified type.
+ else 'type' is an unspecified type.<br />
+ 'valid' is true if the inner type of 'name' exists
+ within the enclosing type, else 'valid' is false.
                           
     The purpose of this metafunction is to encapsulate the 'name' type
     in TTI_MEMBER_TYPE ( or TTI_TRAIT_MEMBER_TYPE ) as the typedef 'type'

Modified: sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp (original)
+++ sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp 2011-01-11 21:48:20 EST (Tue, 11 Jan 2011)
@@ -4,6 +4,7 @@
 #include <boost/config.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/not.hpp>
 #include <boost/mpl/remove.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/preprocessor/arithmetic/add.hpp>
@@ -21,6 +22,7 @@
 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
 #include <boost/function_types/member_function_pointer.hpp>
 #include <boost/function_types/function_type.hpp>
+#include <boost/type_traits/is_same.hpp>
 
 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
 
@@ -277,6 +279,21 @@
       typedef typename boost::function_types::function_type<ftseq>::type type;
       };
       
+ template
+ <
+ class T
+ >
+ struct valid_type :
+ boost::mpl::not_
+ <
+ boost::is_same
+ <
+ T,
+ notype
+ >
+ >
+ {
+ };
     }
   }
   


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