Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81818 - in trunk: boost/bimap/container_adaptor boost/bimap/detail boost/bimap/relation boost/bimap/views libs/bimap/doc libs/bimap/doc/html libs/bimap/doc/html/boost_bimap libs/bimap/test
From: matias.capeletto_at_[hidden]
Date: 2012-12-10 08:13:11


Author: matias
Date: 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
New Revision: 81818
URL: http://svn.boost.org/trac/boost/changeset/81818

Log:
Fixed vector_of and list_of views assign(size_type,value_type) bug.
Fixed vector_of views operator[](size_type) and at(size_type) functions return value.
Text files modified:
   trunk/boost/bimap/container_adaptor/vector_adaptor.hpp | 16 +
   trunk/boost/bimap/detail/map_view_base.hpp | 2
   trunk/boost/bimap/relation/mutant_relation.hpp | 2
   trunk/boost/bimap/relation/structured_pair.hpp | 3
   trunk/boost/bimap/views/vector_map_view.hpp | 34 ++++
   trunk/boost/bimap/views/vector_set_view.hpp | 34 ++++
   trunk/libs/bimap/doc/html/boost_bimap/release_notes.html | 25 ++
   trunk/libs/bimap/doc/html/index.html | 2
   trunk/libs/bimap/doc/release_notes.qbk | 7
   trunk/libs/bimap/test/test_bimap.hpp | 92 +++++++++++
   trunk/libs/bimap/test/test_bimap_sequenced.cpp | 319 ++++++++++++++++++---------------------
   11 files changed, 354 insertions(+), 182 deletions(-)

Modified: trunk/boost/bimap/container_adaptor/vector_adaptor.hpp
==============================================================================
--- trunk/boost/bimap/container_adaptor/vector_adaptor.hpp (original)
+++ trunk/boost/bimap/container_adaptor/vector_adaptor.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -109,25 +109,33 @@
     BOOST_DEDUCED_TYPENAME base_::const_reference
         operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const
     {
- return this->base().operator[](n);
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().operator[](n)
+ );
     }
 
     BOOST_DEDUCED_TYPENAME base_::const_reference
         at(BOOST_DEDUCED_TYPENAME base_::size_type n) const
     {
- return this->base().at(n);
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().at(n)
+ );
     }
 
     BOOST_DEDUCED_TYPENAME base_::reference
         operator[](BOOST_DEDUCED_TYPENAME base_::size_type n)
     {
- return this->base().operator[](n);
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().operator[](n)
+ );
     }
 
     BOOST_DEDUCED_TYPENAME base_::reference
         at(BOOST_DEDUCED_TYPENAME base_::size_type n)
     {
- return this->base().at(n);
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().at(n)
+ );
     }
 };
 

Modified: trunk/boost/bimap/detail/map_view_base.hpp
==============================================================================
--- trunk/boost/bimap/detail/map_view_base.hpp (original)
+++ trunk/boost/bimap/detail/map_view_base.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -484,7 +484,7 @@
             const BOOST_DEDUCED_TYPENAME BASE::value_type& v) \
 { \
     this->clear(); \
- for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++n) \
+ for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++i) \
     { \
         this->push_back(v); \
     } \

Modified: trunk/boost/bimap/relation/mutant_relation.hpp
==============================================================================
--- trunk/boost/bimap/relation/mutant_relation.hpp (original)
+++ trunk/boost/bimap/relation/mutant_relation.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -464,7 +464,7 @@
     return mutant_relation<TA,TB,::boost::mpl::na,force_mutable>(rel.left,r);
 }
 
-}
+} // namespace detail
 
 } // namespace relation
 } // namespace bimaps

Modified: trunk/boost/bimap/relation/structured_pair.hpp
==============================================================================
--- trunk/boost/bimap/relation/structured_pair.hpp (original)
+++ trunk/boost/bimap/relation/structured_pair.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -540,7 +540,8 @@
 {
     return structured_pair<FirstType,SecondType,::boost::mpl::na,Layout>(p.first,s);
 }
-}
+
+} // namespace detail
 
 
 } // namespace relation

Modified: trunk/boost/bimap/views/vector_map_view.hpp
==============================================================================
--- trunk/boost/bimap/views/vector_map_view.hpp (original)
+++ trunk/boost/bimap/views/vector_map_view.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -75,7 +75,41 @@
         this->base() = v.base();
         return *this;
     }
+
+ BOOST_DEDUCED_TYPENAME base_::const_reference
+ operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().operator[](n)
+ );
+ }
+
+ BOOST_DEDUCED_TYPENAME base_::const_reference
+ at(BOOST_DEDUCED_TYPENAME base_::size_type n) const
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().at(n)
+ );
+ }
+
+ BOOST_DEDUCED_TYPENAME base_::reference
+ operator[](BOOST_DEDUCED_TYPENAME base_::size_type n)
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ const_cast<BOOST_DEDUCED_TYPENAME base_::base_type::value_type &>(
+ this->base().operator[](n)
+ ));
+ }
 
+ BOOST_DEDUCED_TYPENAME base_::reference
+ at(BOOST_DEDUCED_TYPENAME base_::size_type n)
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ const_cast<BOOST_DEDUCED_TYPENAME base_::base_type::value_type &>(
+ this->base().at(n)
+ ));
+ }
+
     BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
 
     BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)

Modified: trunk/boost/bimap/views/vector_set_view.hpp
==============================================================================
--- trunk/boost/bimap/views/vector_set_view.hpp (original)
+++ trunk/boost/bimap/views/vector_set_view.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -68,6 +68,40 @@
         return *this;
     }
 
+ BOOST_DEDUCED_TYPENAME base_::const_reference
+ operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().operator[](n)
+ );
+ }
+
+ BOOST_DEDUCED_TYPENAME base_::const_reference
+ at(BOOST_DEDUCED_TYPENAME base_::size_type n) const
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ this->base().at(n)
+ );
+ }
+
+ BOOST_DEDUCED_TYPENAME base_::reference
+ operator[](BOOST_DEDUCED_TYPENAME base_::size_type n)
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ const_cast<BOOST_DEDUCED_TYPENAME base_::base_type::value_type &>(
+ this->base().operator[](n)
+ ));
+ }
+
+ BOOST_DEDUCED_TYPENAME base_::reference
+ at(BOOST_DEDUCED_TYPENAME base_::size_type n)
+ {
+ return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
+ const_cast<BOOST_DEDUCED_TYPENAME base_::base_type::value_type &>(
+ this->base().at(n)
+ ));
+ }
+
     BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
 
     BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)

Modified: trunk/libs/bimap/doc/html/boost_bimap/release_notes.html
==============================================================================
--- trunk/libs/bimap/doc/html/boost_bimap/release_notes.html (original)
+++ trunk/libs/bimap/doc/html/boost_bimap/release_notes.html 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -28,6 +28,25 @@
 </h2></div></div></div>
 <h4>
 <a name="boost_bimap.release_notes.h0"></a>
+ <span class="phrase"><a name="boost_bimap.release_notes.boost_1_53_release"></a></span><a class="link" href="release_notes.html#boost_bimap.release_notes.boost_1_53_release">Boost
+ 1.53 release</a>
+ </h4>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ Refactor map_view_iterator to improve error messages.
+ </li>
+<li class="listitem">
+ Fixed replace_(left/right/key/data) bug when using relations with info.
+ </li>
+<li class="listitem">
+ Fixed vector_of and list_of views <code class="computeroutput"><span class="identifier">assign</span><span class="special">(</span><span class="identifier">size_type</span><span class="special">,</span><span class="identifier">value_type</span><span class="special">)</span></code> bug.
+ </li>
+<li class="listitem">
+ Fixed vector_of views <code class="computeroutput"><span class="keyword">operator</span><span class="special">[](</span><span class="identifier">size_type</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">at</span><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span></code> functions return value.
+ </li>
+</ul></div>
+<h4>
+<a name="boost_bimap.release_notes.h1"></a>
       <span class="phrase"><a name="boost_bimap.release_notes.boost_1_52_release"></a></span><a class="link" href="release_notes.html#boost_bimap.release_notes.boost_1_52_release">Boost
       1.52 release</a>
     </h4>
@@ -35,7 +54,7 @@
           Fixed unused parameter name warnings in Boost.Bimap (#7425).
         </li></ul></div>
 <h4>
-<a name="boost_bimap.release_notes.h1"></a>
+<a name="boost_bimap.release_notes.h2"></a>
       <span class="phrase"><a name="boost_bimap.release_notes.boost_1_50_release"></a></span><a class="link" href="release_notes.html#boost_bimap.release_notes.boost_1_50_release">Boost
       1.50 release</a>
     </h4>
@@ -52,7 +71,7 @@
         </li>
 </ul></div>
 <h4>
-<a name="boost_bimap.release_notes.h2"></a>
+<a name="boost_bimap.release_notes.h3"></a>
       <span class="phrase"><a name="boost_bimap.release_notes.boost_1_45_release"></a></span><a class="link" href="release_notes.html#boost_bimap.release_notes.boost_1_45_release">Boost
       1.45 release</a>
     </h4>
@@ -68,7 +87,7 @@
         </li>
 </ul></div>
 <h4>
-<a name="boost_bimap.release_notes.h3"></a>
+<a name="boost_bimap.release_notes.h4"></a>
       <span class="phrase"><a name="boost_bimap.release_notes.boost_1_35_release"></a></span><a class="link" href="release_notes.html#boost_bimap.release_notes.boost_1_35_release">Boost
       1.35 release</a>
     </h4>

Modified: trunk/libs/bimap/doc/html/index.html
==============================================================================
--- trunk/libs/bimap/doc/html/index.html (original)
+++ trunk/libs/bimap/doc/html/index.html 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -149,7 +149,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: December 09, 2012 at 11:54:01 GMT</small></p></td>
+<td align="left"><p><small>Last revised: December 10, 2012 at 13:07:47 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: trunk/libs/bimap/doc/release_notes.qbk
==============================================================================
--- trunk/libs/bimap/doc/release_notes.qbk (original)
+++ trunk/libs/bimap/doc/release_notes.qbk 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -14,6 +14,13 @@
 
 [section Release notes]
 
+[heading Boost 1.53 release]
+
+* Refactor map_view_iterator to improve error messages.
+* Fixed replace_(left/right/key/data) bug when using relations with info.
+* Fixed vector_of and list_of views `assign(size_type,value_type)` bug.
+* Fixed vector_of views `operator[](size_type)` and `at(size_type)` functions return value.
+
 [heading Boost 1.52 release]
 
 * Fixed unused parameter name warnings in Boost.Bimap ([@https://svn.boost.org/trac/boost/ticket/7425 #7425]).

Modified: trunk/libs/bimap/test/test_bimap.hpp
==============================================================================
--- trunk/libs/bimap/test/test_bimap.hpp (original)
+++ trunk/libs/bimap/test/test_bimap.hpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -18,10 +18,12 @@
 // std
 #include <cassert>
 #include <algorithm>
+#include <iterator>
 
 #include <boost/lambda/lambda.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_same.hpp>
+#include <boost/utility.hpp>
 
 template< class Container, class Data >
 void test_container(Container & c, const Data & d)
@@ -59,7 +61,6 @@
     BOOST_CHECK( c.size() == 2 );
 
     BOOST_CHECK( c.begin() != c.end() );
-
 }
 
 template< class Container, class Data >
@@ -99,6 +100,58 @@
 
     BOOST_CHECK( c.begin() != c.end() );
 
+ c.clear();
+ BOOST_CHECK( c.empty() );
+
+ // assign
+
+ c.assign(d.begin(),d.end());
+ BOOST_CHECK( c.size() == d.size() );
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.begin() ) );
+
+ c.assign(d.size(),*d.begin());
+ BOOST_CHECK( c.size() == d.size() );
+ BOOST_CHECK( *c.begin() == *d.begin() );
+
+ // Check insert(IterPos,InputIter,InputIter)
+
+ c.clear();
+ c.insert( c.begin(), d.begin(), d.end() );
+ c.insert( boost::next(c.begin(),2), d.begin(), d.end() );
+
+ BOOST_CHECK( std::equal( boost::next(c.begin(),2)
+ , boost::next(c.begin(),2+d.size()) , d.begin() ) );
+
+ // Check resize
+
+ c.clear() ;
+ c.resize(4,*d.begin());
+ BOOST_CHECK( c.size() == 4 );
+ BOOST_CHECK( *c.begin() == *d.begin() ) ;
+
+ BOOST_CHECK( c == c );
+ BOOST_CHECK( ! ( c != c ) );
+ BOOST_CHECK( ! ( c < c ) );
+ BOOST_CHECK( ( c <= c ) );
+ BOOST_CHECK( ! ( c > c ) );
+ BOOST_CHECK( ( c >= c ) );
+}
+
+template< class Container, class Data >
+void test_vector_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear() ;
+ c.reserve(2) ;
+ BOOST_CHECK( c.capacity() >= 2 ) ;
+ c.assign(d.begin(),d.end());
+ BOOST_CHECK( c.capacity() >= c.size() ) ;
+
+ BOOST_CHECK( c[0] == *d.begin() ) ;
+ BOOST_CHECK( c.at(1) == *boost::next(d.begin()) );
+
+ test_sequence_container(c,d) ;
 }
 
 template< class Container, class Data >
@@ -234,6 +287,13 @@
 
     test_simple_ordered_associative_container_equality(cr, d);
 
+ BOOST_CHECK( c == c );
+ BOOST_CHECK( ! ( c != c ) );
+ BOOST_CHECK( ! ( c < c ) );
+ BOOST_CHECK( ( c <= c ) );
+ BOOST_CHECK( ! ( c > c ) );
+ BOOST_CHECK( ( c >= c ) );
+
     /*
     BOOST_CHECK( c.range( *c.begin() <= ::boost::lambda::_1,
                             ::boost::lambda::_1 <= *(++c.begin()) ).
@@ -515,5 +575,35 @@
     test_unique_container(b.right, rd);
 }
 
+template< class Bimap, class Data>
+void test_bimap_init_copy_swap(const Data&d)
+{
+ Bimap b1(d.begin(),d.end());
+ Bimap b2( b1 );
+ BOOST_CHECK( b1 == b2 );
+
+ b2.clear();
+ b2 = b1;
+ BOOST_CHECK( b2 == b1 );
+
+ b2.clear();
+ b2.left = b1.left;
+ BOOST_CHECK( b2 == b1 );
+
+ b2.clear();
+ b2.right = b1.right;
+ BOOST_CHECK( b2 == b1 );
+
+ b1.clear();
+ b2.swap(b1);
+ BOOST_CHECK( b2.empty() && !b1.empty() );
+
+ b1.left.swap( b2.left );
+ BOOST_CHECK( b1.empty() && !b2.empty() );
+
+ b1.right.swap( b2.right );
+ BOOST_CHECK( b2.empty() && !b1.empty() );
+}
+
 #endif // LIBS_BIMAP_TEST_BIMAP_TEST_HPP
 

Modified: trunk/libs/bimap/test/test_bimap_sequenced.cpp
==============================================================================
--- trunk/libs/bimap/test/test_bimap_sequenced.cpp (original)
+++ trunk/libs/bimap/test/test_bimap_sequenced.cpp 2012-12-10 08:13:09 EST (Mon, 10 Dec 2012)
@@ -43,6 +43,55 @@
 struct left_tag {};
 struct right_tag {};
 
+
+template< class Container, class Data >
+void test_list_operations(Container & b, Container& c, const Data & d)
+{
+ c.clear() ;
+ c.assign(d.begin(),d.end());
+
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.begin() ) );
+ c.reverse();
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.rbegin() ) );
+
+ c.sort();
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.begin() ) );
+
+ c.push_front( *d.begin() );
+ BOOST_CHECK( c.size() == d.size()+1 );
+ c.unique();
+ BOOST_CHECK( c.size() == d.size() );
+
+ c.relocate( c.begin(), ++c.begin() );
+ c.relocate( c.end(), c.begin(), ++c.begin() );
+
+ b.clear();
+ c.clear();
+
+ c.assign(d.begin(),d.end());
+ b.splice(b.begin(),c);
+
+ BOOST_CHECK( c.size() == 0 );
+ BOOST_CHECK( b.size() == d.size() );
+
+ c.splice(c.begin(),b,++b.begin());
+
+ BOOST_CHECK( c.size() == 1 );
+
+ c.splice(c.begin(),b,b.begin(),b.end());
+
+ BOOST_CHECK( b.size() == 0 );
+
+ b.assign(d.begin(),d.end());
+ c.assign(d.begin(),d.end());
+ b.sort();
+ c.sort();
+ b.merge(c);
+ BOOST_CHECK( b.size() == 2*d.size() );
+
+ b.unique();
+}
+
 void test_bimap()
 {
     using namespace boost::bimaps;
@@ -66,7 +115,7 @@
     {
         typedef bimap<
             list_of< std::string >, vector_of< long >
-
+
> bm_type;
 
         std::set< bm_type::value_type > data;
@@ -77,120 +126,55 @@
 
         bm_type b;
 
+ test_bimap_init_copy_swap<bm_type>(data) ;
         test_sequence_container(b,data);
         test_sequence_container(b.left , left_data);
- test_sequence_container(b.right,right_data);
+ test_vector_container(b.right,right_data);
 
         test_mapped_container(b.left );
         test_mapped_container(b.right);
 
         bm_type c;
+ test_list_operations(b,c,data) ;
+ test_list_operations(b.left,c.left,left_data) ;
+ test_list_operations(b.right,c.right,right_data) ;
 
- // Test assign
-
- b.clear();
- BOOST_CHECK( b.empty() );
-
- b.left.assign(left_data.begin(),left_data.end());
- BOOST_CHECK( b.size() == left_data.size() );
-
- b.right.assign(right_data.begin(),right_data.end());
- BOOST_CHECK( b.size() == right_data.size() );
-
+ c.assign(data.begin(),data.end());
         b.assign(data.begin(),data.end());
- BOOST_CHECK( b.size() == data.size() );
-
- // Test splice and merge
-
- b.clear();
-
- c.left.insert(c.left.begin(),left_data.begin(),left_data.end());
- b.left.splice(b.left.begin(),c.left);
-
- BOOST_CHECK( c.size() == 0 );
- BOOST_CHECK( b.size() == 4 );
-
- c.left.splice(c.left.begin(),b.left,++b.left.begin());
-
- BOOST_CHECK( c.size() == 1 );
-
- c.splice(c.begin(),b,b.begin(),b.end());
-
- BOOST_CHECK( b.size() == 0 );
-
- b.left.merge(c.left);
- c.left.merge(b.left,std::less<std::string>());
-
- b.left.sort();
+ c.remove_if(_key<=bm_type::value_type("1",1));
+ c.sort(std::less<bm_type::value_type>());
+ b.sort(std::less<bm_type::value_type>());
+ c.merge(b,std::less<bm_type::value_type>());
+ c.unique(std::equal_to<bm_type::value_type>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.left.remove_if(_key<="1");
+ c.left.sort(std::less<std::string>());
         b.left.sort(std::less<std::string>());
-
- b.left.unique();
- b.left.unique(std::equal_to<std::string>());
-
- b.assign( data.begin(), data.end() );
-
- BOOST_CHECK( std::equal( b.begin(), b.end(), data.begin() ) );
- b.reverse();
- BOOST_CHECK( std::equal( b.rbegin(), b.rend(), data.begin() ) );
-
- b.sort();
-
- BOOST_CHECK( std::equal( b.begin(), b.end(), data.begin() ) );
-
- b.push_back( bm_type::value_type("4",4) );
- BOOST_CHECK( b.size() == 5 );
- b.unique();
- BOOST_CHECK( b.size() == 4 );
- b.remove_if( _key < bm_type::value_type("2",2) );
- BOOST_CHECK( b.size() == 3 );
-
- b.merge(c);
-
- b.left.remove_if( _key < "3" );
-
- // Test splice and merge
-
- b.clear(); c.clear();
-
- c.left.insert(c.left.begin(),left_data.begin(),left_data.end());
- b.right.splice(b.right.begin(),c.right);
-
- BOOST_CHECK( c.size() == 0 );
- BOOST_CHECK( b.size() == 4 );
-
- c.right.splice(c.right.begin(),b.right,++b.right.begin());
-
- b.right.merge(c.right);
- c.right.merge(b.right,std::less<long>());
-
- b.right.sort();
+ c.left.merge(b.left,std::less<std::string>());
+ c.left.unique(std::equal_to<std::string>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.right.remove_if(_key<=1);
+ c.right.sort(std::less<long>());
         b.right.sort(std::less<long>());
+ c.right.merge(b.right,std::less<long>());
+ c.right.unique(std::equal_to<long>());
 
- b.right.unique();
- b.right.unique(std::equal_to<long>());
-
- b.right.remove_if( _key < 3 );
-
- b.clear();
- b.left.insert(b.left.begin(),left_data.begin(),left_data.end());
-
- b.left.relocate(b.left.begin(), ++b.left.begin() );
- b.left.relocate(b.left.end(), b.left.begin(), ++b.left.begin() );
-
- b.right.relocate(b.right.begin(), ++b.right.begin() );
- b.right.relocate(b.right.end(), b.right.begin(), ++b.right.begin() );
-
- b.relocate(b.begin(), ++b.begin() );
- b.relocate(b.end(), b.begin(), ++b.begin() );
+ c.assign(data.begin(),data.end());
+ c.right[0].first = -1;
+ c.right.at(0).second = "[1]";
     }
     //--------------------------------------------------------------------
 
-
+
     //--------------------------------------------------------------------
     {
         typedef bimap
         <
- list_of<std::string>, list_of<long>,
+ vector_of<std::string>, list_of<long>,
             vector_of_relation
 
> bm_type;
@@ -200,92 +184,87 @@
         data.insert( bm_type::value_type("2",2) );
         data.insert( bm_type::value_type("3",3) );
         data.insert( bm_type::value_type("4",4) );
-
+
         bm_type b;
- b.push_back( bm_type::value_type("1",1) );
- b.push_back( bm_type::value_type("2",2) );
- b.push_back( bm_type::value_type("3",3) );
- b.push_back( bm_type::value_type("4",4) );
-
- BOOST_CHECK( std::equal( b.begin(), b.end(), data.begin() ) );
- b.reverse();
- BOOST_CHECK( std::equal( b.rbegin(), b.rend(), data.begin() ) );
-
- b.sort();
-
- BOOST_CHECK( std::equal( b.begin(), b.end(), data.begin() ) );
-
- b.push_back( bm_type::value_type("4",4) );
- BOOST_CHECK( b.size() == 5 );
- b.unique();
- BOOST_CHECK( b.size() == 4 );
- b.remove_if( _key < bm_type::value_type("2",2) );
- BOOST_CHECK( b.size() == 3 );
-
- b.relocate( b.begin(), ++b.begin() );
- b.relocate( b.end(), b.begin(), ++b.begin() );
-
- b.clear();
- BOOST_CHECK( b.empty() );
-
- b.left.assign(left_data.begin(),left_data.end());
- BOOST_CHECK( b.size() == left_data.size() );
-
- b.right.assign(right_data.begin(),right_data.end());
- BOOST_CHECK( b.size() == right_data.size() );
-
+
+ test_bimap_init_copy_swap<bm_type>(data) ;
+ test_vector_container(b,data) ;
+
+ bm_type c;
+ test_list_operations(b,c,data) ;
+ test_list_operations(b.left,c.left,left_data) ;
+ test_list_operations(b.right,c.right,right_data) ;
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.remove_if(_key<=bm_type::value_type("1",1));
+ c.sort(std::less<bm_type::value_type>());
+ b.sort(std::less<bm_type::value_type>());
+ c.merge(b,std::less<bm_type::value_type>());
+ c.unique(std::equal_to<bm_type::value_type>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.left.remove_if(_key<="1");
+ c.left.sort(std::less<std::string>());
+ b.left.sort(std::less<std::string>());
+ c.left.merge(b.left,std::less<std::string>());
+ c.left.unique(std::equal_to<std::string>());
+
+ c.assign(data.begin(),data.end());
         b.assign(data.begin(),data.end());
- BOOST_CHECK( b.size() == data.size() );
+ c.right.remove_if(_key<=1);
+ c.right.sort(std::less<long>());
+ b.right.sort(std::less<long>());
+ c.right.merge(b.right,std::less<long>());
+ c.right.unique(std::equal_to<long>());
+
+ c.assign(data.begin(),data.end());
+ c[0].left = "(1)";
+ c.at(0).right = -1;
+ c.left[0].first = "[1]";
+ c.left.at(0).second = -1;
     }
     //--------------------------------------------------------------------
 
-
+
     //--------------------------------------------------------------------
     {
         typedef bimap
         <
- vector_of< short >, list_of< short >,
- vector_of_relation
-
- > bimap_type;
-
- bimap_type b1;
-
- b1.push_back( bimap_type::value_type(1,2) );
-
- bimap_type b2( b1 );
-
- BOOST_CHECK( b1 == b2 );
- BOOST_CHECK( ! ( b1 != b2 ) );
- BOOST_CHECK( b1 <= b2 );
- BOOST_CHECK( b1 >= b2 );
- BOOST_CHECK( ! ( b1 < b2 ) );
- BOOST_CHECK( ! ( b1 > b2 ) );
-
- b1.push_back( bimap_type::value_type(2,3) );
-
- b2 = b1;
- BOOST_CHECK( b2 == b1 );
-
- b1.push_back( bimap_type::value_type(3,4) );
-
- b2.left = b1.left;
- BOOST_CHECK( b2 == b1 );
-
- b1.push_back( bimap_type::value_type(4,5) );
+ vector_of<std::string>, list_of<long>,
+ list_of_relation
 
- b2.right = b1.right;
- BOOST_CHECK( b2 == b1 );
-
- b1.clear();
- b2.swap(b1);
- BOOST_CHECK( b2.empty() && !b1.empty() );
+ > bm_type;
 
- b1.left.swap( b2.left );
- BOOST_CHECK( b1.empty() && !b2.empty() );
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type("1",1) );
+ data.insert( bm_type::value_type("2",2) );
+ data.insert( bm_type::value_type("3",3) );
+ data.insert( bm_type::value_type("4",4) );
+
+ bm_type b;
+
+ test_bimap_init_copy_swap<bm_type>(data) ;
+ test_sequence_container(b,data) ;
+
+ bm_type c;
+ test_list_operations(b,c,data) ;
+ test_list_operations(b.left,c.left,left_data) ;
+ test_list_operations(b.right,c.right,right_data) ;
 
- b1.right.swap( b2.right );
- BOOST_CHECK( b2.empty() && !b1.empty() );
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.remove_if(_key<=bm_type::value_type("1",1));
+ c.sort(std::less<bm_type::value_type>());
+ b.sort(std::less<bm_type::value_type>());
+ c.merge(b,std::less<bm_type::value_type>());
+ c.unique(std::equal_to<bm_type::value_type>());
+
+ c.assign(data.begin(),data.end());
+ c.left[0].first = "[1]";
+ c.left.at(0).second = -1;
     }
     //--------------------------------------------------------------------
 


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