Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54507 - in sandbox/monotonic: boost/heterogenous libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-29 18:04:00


Author: cschladetsch
Date: 2009-06-29 18:03:59 EDT (Mon, 29 Jun 2009)
New Revision: 54507
URL: http://svn.boost.org/trac/boost/changeset/54507

Log:
made map.key.value return a reference to the map, for chaining of insertions

Text files modified:
   sandbox/monotonic/boost/heterogenous/map.hpp | 3 ++-
   sandbox/monotonic/libs/monotonic/test/clones/tests.cpp | 12 +++++++++++-
   2 files changed, 13 insertions(+), 2 deletions(-)

Modified: sandbox/monotonic/boost/heterogenous/map.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/map.hpp (original)
+++ sandbox/monotonic/boost/heterogenous/map.hpp 2009-06-29 18:03:59 EDT (Mon, 29 Jun 2009)
@@ -75,10 +75,11 @@
                                                 }
 
                                                 template <class U>
- /*std::pair<iterator,bool> */void value()
+ this_type &value()
                                                 {
                                                         U *val = parent->construct_type<U>();
                                                         parent->insert(std::make_pair(key_instance, val));
+ return *parent;
                                                 }
                                         };
 

Modified: sandbox/monotonic/libs/monotonic/test/clones/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/clones/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/clones/tests.cpp 2009-06-29 18:03:59 EDT (Mon, 29 Jun 2009)
@@ -173,6 +173,14 @@
 {
 };
 
+struct T2 : heterogenous::base<T0, my_base>
+{
+};
+
+struct T3 : heterogenous::base<T1, my_base>
+{
+};
+
 struct my_less
 {
         bool operator()(my_base const *left, my_base const *right) const
@@ -185,7 +193,9 @@
 {
         heterogenous::map<my_less, my_base> map;
 
- map.key<T0>().value<T1>();
+ map .key<T0>().value<T1>()
+ .key<T2>().value<T3>()
+ ;
 
 }
 


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