Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74923 - in trunk/boost/proto: . transform
From: eric_at_[hidden]
Date: 2011-10-11 21:18:49


Author: eric_niebler
Date: 2011-10-11 21:18:47 EDT (Tue, 11 Oct 2011)
New Revision: 74923
URL: http://svn.boost.org/trac/boost/changeset/74923

Log:
better fix for the is_transform problem
Text files modified:
   trunk/boost/proto/proto_fwd.hpp | 10 ++++-
   trunk/boost/proto/traits.hpp | 65 ++++++++++++++++++++++++----------------
   trunk/boost/proto/transform/call.hpp | 8 ++--
   trunk/boost/proto/transform/make.hpp | 9 +----
   4 files changed, 53 insertions(+), 39 deletions(-)

Modified: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp (original)
+++ trunk/boost/proto/proto_fwd.hpp 2011-10-11 21:18:47 EDT (Tue, 11 Oct 2011)
@@ -187,6 +187,12 @@
         struct not_a_domain;
         struct not_a_grammar;
         struct not_a_generator;
+
+ template<typename T, typename Void = void>
+ struct is_transform_;
+
+ template<typename T, typename Void = void>
+ struct is_aggregate_;
     }
 
     typedef detail::ignore const ignore;
@@ -682,10 +688,10 @@
     template<typename T>
     struct is_callable;
 
- template<typename T, typename Void = void>
+ template<typename T>
     struct is_transform;
 
- template<typename T, typename Void = void>
+ template<typename T>
     struct is_aggregate;
 
     #define BOOST_PROTO_UNEXPR() typedef int proto_is_expr_;

Modified: trunk/boost/proto/traits.hpp
==============================================================================
--- trunk/boost/proto/traits.hpp (original)
+++ trunk/boost/proto/traits.hpp 2011-10-11 21:18:47 EDT (Tue, 11 Oct 2011)
@@ -127,6 +127,19 @@
     {};
     #endif
 
+ namespace detail
+ {
+ template<typename T, typename Void /*= void*/>
+ struct is_transform_
+ : mpl::false_
+ {};
+
+ template<typename T>
+ struct is_transform_<T, typename T::proto_is_transform_>
+ : mpl::true_
+ {};
+ }
+
     /// \brief Boolean metafunction which detects whether a type is
     /// a PrimitiveTransform type or not.
     ///
@@ -142,15 +155,33 @@
     /// for \c void, <tt>is_transform\<T\>::value</tt> is \c true. (Note: this is
     /// the case for any type that derives from an instantiation of \c proto::transform.)
     /// \li Otherwise, <tt>is_transform\<T\>::value</tt> is \c false.
- template<typename T, typename Void /*= void*/>
+ template<typename T>
     struct is_transform
- : mpl::false_
+ : proto::detail::is_transform_<T>
     {};
 
- template<typename T>
- struct is_transform<T, typename T::proto_is_transform_>
- : mpl::true_
- {};
+ namespace detail
+ {
+ template<typename T, typename Void /*= void*/>
+ struct is_aggregate_
+ : is_pod<T>
+ {};
+
+ template<typename Tag, typename Args, long N>
+ struct is_aggregate_<proto::expr<Tag, Args, N>, void>
+ : mpl::true_
+ {};
+
+ template<typename Tag, typename Args, long N>
+ struct is_aggregate_<proto::basic_expr<Tag, Args, N>, void>
+ : mpl::true_
+ {};
+
+ template<typename T>
+ struct is_aggregate_<T, typename T::proto_is_aggregate_>
+ : mpl::true_
+ {};
+ }
 
     /// \brief A Boolean metafunction that indicates whether a type requires
     /// aggregate initialization.
@@ -161,27 +192,9 @@
     /// If <tt>is_aggregate\<T\>::value</tt> is \c true, then an object of
     /// type T will be initialized as <tt>T t = {a0,a1,...aN};</tt>. Otherwise,
     /// it will be initialized as <tt>T t(a0,a1,...aN)</tt>.
- template<typename T, typename Void>
- struct is_aggregate
- : is_pod<T>
- {};
-
- /// \brief Specialization of <tt>is_aggregate\<\></tt> that indicates
- /// that objects of <tt>expr\<\></tt> type require aggregate initialization.
- template<typename Tag, typename Args, long N>
- struct is_aggregate<proto::expr<Tag, Args, N>, void>
- : mpl::true_
- {};
-
- template<typename Tag, typename Args, long N>
- struct is_aggregate<proto::basic_expr<Tag, Args, N>, void>
- : mpl::true_
- {};
-
- /// INTERNAL ONLY
     template<typename T>
- struct is_aggregate<T, typename T::proto_is_aggregate_>
- : mpl::true_
+ struct is_aggregate
+ : proto::detail::is_aggregate_<T>
     {};
 
     /// \brief A Boolean metafunction that indicates whether a given

Modified: trunk/boost/proto/transform/call.hpp
==============================================================================
--- trunk/boost/proto/transform/call.hpp (original)
+++ trunk/boost/proto/transform/call.hpp 2011-10-11 21:18:47 EDT (Tue, 11 Oct 2011)
@@ -124,7 +124,7 @@
         /// a typedef for <tt>boost::result_of\<Fun(Expr, State, Data)\>::type</tt>.
         template<typename Expr, typename State, typename Data>
         struct impl
- : impl2<Expr, State, Data, is_transform<Fun>::value>
+ : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
         {};
     };
 
@@ -193,7 +193,7 @@
         /// \param d An arbitrary data
         template<typename Expr, typename State, typename Data>
         struct impl
- : impl2<Expr, State, Data, is_transform<Fun>::value>
+ : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
         {};
     };
 
@@ -271,7 +271,7 @@
         /// \param d An arbitrary data
         template<typename Expr, typename State, typename Data>
         struct impl
- : impl2<Expr, State, Data, is_transform<Fun>::value>
+ : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
         {};
     };
 
@@ -337,7 +337,7 @@
 
         template<typename Expr, typename State, typename Data>
         struct impl
- : impl2<Expr, State, Data, is_transform<Fun>::value>
+ : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
         {};
     };
 

Modified: trunk/boost/proto/transform/make.hpp
==============================================================================
--- trunk/boost/proto/transform/make.hpp (original)
+++ trunk/boost/proto/transform/make.hpp 2011-10-11 21:18:47 EDT (Tue, 11 Oct 2011)
@@ -37,13 +37,8 @@
     namespace detail
     {
         template<typename T>
- struct is_transform_wrap
- : is_transform<T>
- {};
-
- template<typename T>
         struct is_applyable
- : mpl::and_<is_callable<T>, is_transform_wrap<T> >
+ : mpl::and_<is_callable<T>, is_transform<T> >
         {};
 
         template<typename T, bool HasType = mpl::aux::has_type<T>::value>
@@ -117,7 +112,7 @@
         };
         #endif
 
- template<typename Type, bool IsAggregate = is_aggregate<Type>::value>
+ template<typename Type, bool IsAggregate = detail::is_aggregate_<Type>::value>
         struct construct_
         {
             typedef Type result_type;


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