Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48908 - in branches/release: . libs/proto/example
From: eric_at_[hidden]
Date: 2008-09-20 01:04:44


Author: eric_niebler
Date: 2008-09-20 01:04:44 EDT (Sat, 20 Sep 2008)
New Revision: 48908
URL: http://svn.boost.org/trac/boost/changeset/48908

Log:
Merged revisions 48906-48907 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r48906 | eric_niebler | 2008-09-19 21:31:20 -0700 (Fri, 19 Sep 2008) | 1 line
  
  fix futures example
........
  r48907 | eric_niebler | 2008-09-19 22:01:49 -0700 (Fri, 19 Sep 2008) | 1 line
  
  fix map_assign example
........

Properties modified:
   branches/release/ (props changed)
Text files modified:
   branches/release/libs/proto/example/futures.cpp | 18 +++++++++---------
   branches/release/libs/proto/example/map_assign.cpp | 14 ++++++++------
   2 files changed, 17 insertions(+), 15 deletions(-)

Modified: branches/release/libs/proto/example/futures.cpp
==============================================================================
--- branches/release/libs/proto/example/futures.cpp (original)
+++ branches/release/libs/proto/example/futures.cpp 2008-09-20 01:04:44 EDT (Sat, 20 Sep 2008)
@@ -6,7 +6,7 @@
 // This is an example of using Proto transforms to implement
 // Howard Hinnant's future group proposal.
 
-#include <boost/fusion/tuple.hpp>
+#include <boost/fusion/include/vector.hpp>
 #include <boost/fusion/include/as_vector.hpp>
 #include <boost/fusion/include/joint_view.hpp>
 #include <boost/fusion/include/single_view.hpp>
@@ -39,8 +39,8 @@
       , proto::when<
             proto::logical_and<FutureGroup, FutureGroup>
           , fusion::joint_view<
- boost::add_const<FutureGroup(proto::_left)>,
- boost::add_const<FutureGroup(proto::_right)>
+ boost::add_const<FutureGroup(proto::_left)>
+ , boost::add_const<FutureGroup(proto::_right)>
>(FutureGroup(proto::_left), FutureGroup(proto::_right))
>
         // (a || b) becomes the sequence for 'a', so long
@@ -109,19 +109,19 @@
 
 int main()
 {
- using fusion::tuple;
+ using fusion::vector;
     future<A> a;
     future<B> b;
     future<C> c;
- future<tuple<A,B> > ab;
+ future<vector<A,B> > ab;
 
     // Verify that various future groups have the
     // correct return types.
     A t0 = a.get();
- tuple<A, B, C> t1 = (a && b && c).get();
- tuple<A, C> t2 = ((a || a) && c).get();
- tuple<A, B, C> t3 = ((a && b || a && b) && c).get();
- tuple<tuple<A, B>, C> t4 = ((ab || ab) && c).get();
+ vector<A, B, C> t1 = (a && b && c).get();
+ vector<A, C> t2 = ((a || a) && c).get();
+ vector<A, B, C> t3 = ((a && b || a && b) && c).get();
+ vector<vector<A, B>, C> t4 = ((ab || ab) && c).get();
 
     return 0;
 }

Modified: branches/release/libs/proto/example/map_assign.cpp
==============================================================================
--- branches/release/libs/proto/example/map_assign.cpp (original)
+++ branches/release/libs/proto/example/map_assign.cpp 2008-09-20 01:04:44 EDT (Sat, 20 Sep 2008)
@@ -86,10 +86,11 @@
     BOOST_PROTO_BASIC_EXTENDS(Expr, map_list_of_expr, map_list_of_dom)
     BOOST_PROTO_EXTENDS_FUNCTION()
 
- template<typename Map>
- operator Map() const
+ template<typename Key, typename Value, typename Cmp, typename Al>
+ operator std::map<Key, Value, Cmp, Al> () const
     {
- Map map;
+ BOOST_MPL_ASSERT((proto::matches<Expr, MapListOf>));
+ std::map<Key, Value, Cmp, Al> map;
         return MapListOf()(*this, 0, map);
     }
 };
@@ -101,11 +102,11 @@
     // Initialize a map:
     std::map<std::string, int> op =
         map_list_of
- ("<",1)
+ ("<", 1)
             ("<=",2)
- (">",3)
+ (">", 3)
             (">=",4)
- ("=",5)
+ ("=", 5)
             ("<>",6)
         ;
 
@@ -119,3 +120,4 @@
     return 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