Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64385 - in sandbox/SOC/2010/phoenix3: boost/phoenix/statement libs/phoenix/test/boost_bind_compatibility libs/phoenix/test/statement
From: thom.heller_at_[hidden]
Date: 2010-07-27 09:06:39


Author: theller
Date: 2010-07-27 09:06:38 EDT (Tue, 27 Jul 2010)
New Revision: 64385
URL: http://svn.boost.org/trac/boost/changeset/64385

Log:
fixed switch (but not for gcc-4.2)
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/statement/switch.hpp | 26 +++++++++-----------------
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_cdecl_mf_test.cpp | 1 -
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_rv_sp_test.cpp | 2 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/statement/switch_tests.cpp | 39 +++++++++++----------------------------
   4 files changed, 21 insertions(+), 47 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/statement/switch.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/statement/switch.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/statement/switch.hpp 2010-07-27 09:06:38 EDT (Tue, 27 Jul 2010)
@@ -59,24 +59,13 @@
             struct result;
 
             template <typename This, typename Expr, typename State>
- struct result<This(Expr const&, State&)>
- : fusion::result_of::push_front<State, Expr>
+ struct result<This(Expr, State)>
+ : fusion::result_of::push_front<typename remove_const<typename remove_reference<State>::type>::type const, typename remove_const<typename remove_reference<Expr>::type>::type>
             {};
 
- template <typename This, typename Expr, typename State>
- struct result<This(Expr&, State&)>
- : fusion::result_of::push_front<State, Expr>
- {};
-
- template <typename This, typename Expr, typename State>
- struct result<This(Expr, State&)>
- : fusion::result_of::push_front<State, Expr>
- {};
-
-
             template <typename Expr, typename State>
- typename fusion::result_of::push_front<State, Expr>::type
- operator()(Expr const& expr, State& state)
+ typename fusion::result_of::push_front<typename remove_const<typename remove_reference<State>::type>::type const, typename remove_const<typename remove_reference<Expr>::type>::type>::type
+ operator()(Expr expr, State state) const
             {
                 return fusion::push_front(state, expr);
             }
@@ -203,8 +192,9 @@
         typename make_switch<
             Cond
           , typename fusion::result_of::as_vector<
+ //typename switch_grammar::impl<Cases const&, fusion::vector0<>&,int>::result_type
                 typename boost::result_of<
- switch_grammar(Cases const&, fusion::vector0<> const&)
+ switch_grammar(Cases const&, fusion::vector0<>&)
>::type
>::type
>::type
@@ -213,13 +203,15 @@
             BOOST_PROTO_ASSERT_MATCHES( cases, switch_grammar );
             typedef
                 typename fusion::result_of::as_vector<
+ //typename switch_grammar::impl<Cases const&, fusion::vector0<>&,int>::result_type
                     typename boost::result_of<
                         switch_grammar(Cases const&, fusion::vector0<>&)
>::type
>::type
                 cases_type;
 
- return make_switch<Cond, cases_type>()(cond, fusion::as_vector(switch_grammar()(cases, fusion::vector0<>())));
+ fusion::vector0<> v;
+ return make_switch<Cond, cases_type>()(cond, fusion::as_vector(switch_grammar()(cases, v)));
         }
 
         Cond const& cond;

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_cdecl_mf_test.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_cdecl_mf_test.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_cdecl_mf_test.cpp 2010-07-27 09:06:38 EDT (Tue, 27 Jul 2010)
@@ -58,7 +58,6 @@
 
     bind(&X::f0, &x)();
     bind(&X::f0, ref(x))();
- bind(&X::f0, x)();
 
     bind(&X::g0, &x)();
     bind(&X::g0, x)();

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_rv_sp_test.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_rv_sp_test.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/boost_bind_compatibility/bind_rv_sp_test.cpp 2010-07-27 09:06:38 EDT (Tue, 27 Jul 2010)
@@ -40,7 +40,7 @@
     {
     }
 
- int f()
+ int f() const
     {
         return v_;
     }

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/statement/switch_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/statement/switch_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/statement/switch_tests.cpp 2010-07-27 09:06:38 EDT (Tue, 27 Jul 2010)
@@ -34,61 +34,44 @@
         switch_(_1)
         [
             // wierd case, why not just use if(...), but valid, nonetheless
- //case_<4>(cout << val("<4>") << endl)
- case_<4>(cout << ref("<4>") << endl)
+ case_<4>(cout << val("<4>") << endl)
         ]
     );
 
     cout << endl;
 
- /*
     for_each(v.begin(), v.end(),
         switch_(_1)
         [
             // wierd case, but valid, nonetheless
- //default_(cout << val("<any...>") << endl)
- default_(cout << ref("<any...>") << endl)
+ default_(cout << val("<any...>") << endl)
         ]
     );
- */
 
     cout << endl;
 
- /*
     for_each(v.begin(), v.end(),
         switch_(_1)
         [
- //case_<1>(cout << val("<1>") << endl),
- case_<1>(cout << ref("<1>") << endl),
- //case_<2>(cout << val("<2>") << endl),
- case_<2>(cout << ref("<2>") << endl),
- //case_<3>(cout << val("<3>") << endl)//,
- case_<3>(cout << ref("<3>") << endl),
- //case_<4>(cout << val("<4>") << endl)
- case_<4>(cout << ref("<4>") << endl)
+ case_<1>(cout << val("<1>") << endl),
+ case_<2>(cout << val("<2>") << endl),
+ case_<3>(cout << val("<3>") << endl),
+ case_<4>(cout << val("<4>") << endl)
         ]
     );
- */
 
     cout << endl;
 
- /*
     for_each(v.begin(), v.end(),
         switch_(_1)
         [
- //case_<1>(cout << val("<1>") << endl),
- case_<1>(cout << ref("<1>") << endl),
- //case_<2>(cout << val("<2>") << endl),
- case_<2>(cout << ref("<2>") << endl),
- //case_<3>(cout << val("<3>") << endl),
- case_<3>(cout << ref("<3>") << endl),
- //case_<4>(cout << val("<4>") << endl),
- case_<4>(cout << ref("<4>") << endl),
- //default_(cout << val("<over 4>") << endl)
- default_(cout << ref("<over 4>") << endl)
+ case_<1>(cout << val("<1>") << endl),
+ case_<2>(cout << val("<2>") << endl),
+ case_<3>(cout << val("<3>") << endl),
+ case_<4>(cout << val("<4>") << endl),
+ default_(cout << val("<over 4>") << endl)
         ]
     );
- */
 
     return boost::report_errors();
 }


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