Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66641 - in sandbox/SOC/2010/phoenix3: boost/phoenix boost/phoenix/object libs/phoenix/test/object
From: thom.heller_at_[hidden]
Date: 2010-11-19 02:17:32


Author: theller
Date: 2010-11-19 02:17:14 EST (Fri, 19 Nov 2010)
New Revision: 66641
URL: http://svn.boost.org/trac/boost/changeset/66641

Log:
finished refactoring of delete
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp | 2 +-
   sandbox/SOC/2010/phoenix3/boost/phoenix/object/delete.hpp | 37 +++++++++++++++++++++++++++----------
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp | 14 +++++++-------
   3 files changed, 35 insertions(+), 18 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp 2010-11-19 02:17:14 EST (Fri, 19 Nov 2010)
@@ -10,7 +10,7 @@
 
 #include <boost/phoenix/object/const_cast.hpp>
 //#include <boost/phoenix/object/construct.hpp>
-//#include <boost/phoenix/object/delete.hpp>
+#include <boost/phoenix/object/delete.hpp>
 #include <boost/phoenix/object/dynamic_cast.hpp>
 //#include <boost/phoenix/object/new.hpp>
 #include <boost/phoenix/object/reinterpret_cast.hpp>

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/delete.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/delete.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/delete.hpp 2010-11-19 02:17:14 EST (Fri, 19 Nov 2010)
@@ -8,21 +8,36 @@
 #ifndef PHOENIX_OBJECT_DELETE_HPP
 #define PHOENIX_OBJECT_DELETE_HPP
 
-#include <boost/phoenix/core/compose.hpp>
+#include <boost/phoenix/core/expression.hpp>
 
 namespace boost { namespace phoenix
 {
+ namespace tag {
+ struct delete_ {};
+ }
 
- namespace result_of
+ namespace expression
     {
- template <typename Env, typename P>
+ template <typename T>
         struct delete_
- {
- typedef void type;
- };
+ : expr<tag::delete_, T>
+ {};
     }
 
+ namespace rule
+ {
+ struct delete_
+ : expression::delete_<meta_grammar>
+ {};
+ }
+
+ template <typename Dummy>
+ struct meta_grammar::case_<tag::delete_, Dummy>
+ : proto::when<rule::delete_, proto::external_transform>
+ {};
+
     struct delete_eval
+ : proto::callable
     {
         typedef void result_type;
 
@@ -34,14 +49,16 @@
         }
     };
 
- template <typename P>
- struct make_delete : compose<delete_eval, P> {};
+ template <typename Dummy>
+ struct default_actions::when<rule::delete_, Dummy>
+ : proto::call<delete_eval(_env, proto::_child_c<0>)>
+ {};
 
     template <typename P>
- typename make_delete<P>::type const
+ typename expression::delete_<P>::type const
     delete_(P const& p)
     {
- return make_delete<P>()(p);
+ return expression::delete_<P>::make(p);
     }
 
 }}

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp 2010-11-19 02:17:14 EST (Fri, 19 Nov 2010)
@@ -29,9 +29,9 @@
 main()
 {
     using boost::phoenix::arg_names::arg1;
- using boost::phoenix::construct;
+ //using boost::phoenix::construct;
     using boost::phoenix::delete_;
- using boost::phoenix::new_;
+ //using boost::phoenix::new_;
 
     using std::for_each;
     using std::vector;
@@ -39,19 +39,19 @@
     {
         vector<X*> v(10);
 
- for_each(v.begin(), v.end(), arg1 = new_<X>());
+ //for_each(v.begin(), v.end(), arg1 = new_<X>());
         for_each(v.begin(), v.end(), delete_(arg1));
 
- for_each(v.begin(), v.end(), arg1 = new_<X>(1, 2, 3));
+ //for_each(v.begin(), v.end(), arg1 = new_<X>(1, 2, 3));
         for_each(v.begin(), v.end(), delete_(arg1));
     }
 
     {
         using boost::shared_ptr;
         vector<shared_ptr<X> > v(10);
- for_each(v.begin(), v.end(),
- arg1 = construct<shared_ptr<X> >(new_<X>())
- );
+ //for_each(v.begin(), v.end(),
+ // arg1 = construct<shared_ptr<X> >(new_<X>())
+ //);
     }
 
     BOOST_TEST(n == 0);


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