Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71891 - trunk/boost/phoenix/core
From: thom.heller_at_[hidden]
Date: 2011-05-12 10:13:44


Author: theller
Date: 2011-05-12 10:13:43 EDT (Thu, 12 May 2011)
New Revision: 71891
URL: http://svn.boost.org/trac/boost/changeset/71891

Log:
[phoenix]
    - Fixed Warning in as_actor::convert

Text files modified:
   trunk/boost/phoenix/core/as_actor.hpp | 46 ++++-----------------------------------
   trunk/boost/phoenix/core/value.hpp | 45 +++++++++++---------------------------
   2 files changed, 18 insertions(+), 73 deletions(-)

Modified: trunk/boost/phoenix/core/as_actor.hpp
==============================================================================
--- trunk/boost/phoenix/core/as_actor.hpp (original)
+++ trunk/boost/phoenix/core/as_actor.hpp 2011-05-12 10:13:43 EDT (Thu, 12 May 2011)
@@ -12,51 +12,15 @@
 
 namespace boost { namespace phoenix
 {
- template <typename T>
- struct as_actor_base; // defined in value.hpp
-
- template <typename Base>
- struct as_actor_base<actor<Base> >
- {
- typedef typename actor<Base>::expr_type type;
-
- static type const&
- convert(actor<Base> const& x)
- {
- return x.proto_expr_;
- }
- };
-
- template <>
- struct as_actor_base<fusion::void_>
- {
- typedef fusion::void_ type;
- struct error_attempting_to_convert_void_type_to_an_actor {};
-
- static void
- convert(error_attempting_to_convert_void_type_to_an_actor);
- };
-
- template <>
- struct as_actor_base<void>
- {
- typedef void type;
- struct error_attempting_to_convert_void_type_to_an_actor {};
-
- static void
- convert(error_attempting_to_convert_void_type_to_an_actor);
- };
-
- template <typename T>
+ template <typename T, typename U = typename is_actor<T>::type >
     struct as_actor
     {
- typedef actor<typename as_actor_base<T>::type> type;
+ typedef T type;
 
- static type
- convert(T const& x)
+ static type const &
+ convert(T const & t)
         {
- type e = {{as_actor_base<T>::convert(x)}};
- return e;
+ return t;
         }
     };
 }}

Modified: trunk/boost/phoenix/core/value.hpp
==============================================================================
--- trunk/boost/phoenix/core/value.hpp (original)
+++ trunk/boost/phoenix/core/value.hpp 2011-05-12 10:13:43 EDT (Thu, 12 May 2011)
@@ -84,44 +84,25 @@
         {
             typedef T type;
         };
- }
-
- template <typename T>
- struct as_actor_base
- {
- typedef typename expression::value<T>::type type;
 
- static typename expression::value<T>::type
- convert(typename meta::argument_type<T>::type x)
+ template <typename T>
+ struct decay
         {
- return expression::value<T>::make(x);
- }
- };
-
- // Sometimes it is necessary to auto-convert references to
- // a value<T>. This happens when we are re-currying. This
- // cannot happen through the standard public actor interfaces.
+ typedef T type;
+ };
+ template <typename T, int N>
+ struct decay<T[N]> : decay<T const *> {};
+ }
+
     template <typename T>
- struct as_actor_base<T&>
- {
- typedef typename expression::value<T>::type type;
-
- static typename expression::value<T>::type
- convert(T& x)
- {
- return expression::value<T>::make(x);
- }
- };
-
- template <typename T, int N>
- struct as_actor_base<T[N]>
+ struct as_actor<T, mpl::false_>
     {
- typedef typename expression::value<T const *>::type type;
+ typedef typename expression::value<typename meta::decay<T>::type >::type type;
 
- static typename expression::value<T const *>::type
- convert(T const x[N])
+ static type
+ convert(typename meta::argument_type<typename meta::decay<T>::type>::type t)
         {
- return expression::value<T const*>::make(x);
+ return expression::value<typename meta::decay<T>::type >::make(t);
         }
     };
 }}


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