Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80228 - in trunk/libs/unordered/test: objects unordered
From: dnljms_at_[hidden]
Date: 2012-08-25 17:56:17


Author: danieljames
Date: 2012-08-25 17:56:16 EDT (Sat, 25 Aug 2012)
New Revision: 80228
URL: http://svn.boost.org/trac/boost/changeset/80228

Log:
Unordered: Weaken requirements in compile tests.

Assigning a container requires that its elements can be assignable. Could split
the tests up so that other tests aren't assignable, but it doesn't seem worth
the hassle.
Text files modified:
   trunk/libs/unordered/test/objects/minimal.hpp | 22 +++++++++++++---------
   trunk/libs/unordered/test/unordered/compile_map.cpp | 30 +++++++++++++++---------------
   2 files changed, 28 insertions(+), 24 deletions(-)

Modified: trunk/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/minimal.hpp (original)
+++ trunk/libs/unordered/test/objects/minimal.hpp 2012-08-25 17:56:16 EDT (Sat, 25 Aug 2012)
@@ -26,7 +26,7 @@
     class destructible;
     class copy_constructible;
     class copy_constructible_equality_comparable;
- class default_copy_constructible;
+ class default_assignable;
     class assignable;
 
     struct ampersand_operator_used {};
@@ -99,26 +99,29 @@
         return false;
     }
 
- class default_copy_constructible
+ class default_assignable
     {
     public:
- default_copy_constructible(constructor_param const&) {}
+ default_assignable(constructor_param const&) {}
 
- default_copy_constructible()
+ default_assignable()
         {
         }
 
- default_copy_constructible(default_copy_constructible const&)
+ default_assignable(default_assignable const&)
         {
         }
 
- ~default_copy_constructible()
+ default_assignable& operator=(default_assignable const&)
+ {
+ return *this;
+ }
+
+ ~default_assignable()
         {
         }
 
     private:
- default_copy_constructible& operator=(
- default_copy_constructible const&);
         ampersand_operator_used operator&() const {
             return ampersand_operator_used(); }
     };
@@ -148,7 +151,7 @@
         movable1() {}
         explicit movable1(movable_init) {}
         movable1(BOOST_RV_REF(movable1)) {}
- movable1& operator=(BOOST_RV_REF(movable1));
+ movable1& operator=(BOOST_RV_REF(movable1)) { return *this; }
         ~movable1() {}
     };
 
@@ -160,6 +163,7 @@
         explicit movable2(movable_init) {}
         movable2(movable2&&) {}
         ~movable2() {}
+ movable2& operator=(movable2&&) { return *this; }
     private:
         movable2() {}
         movable2(movable2 const&);

Modified: trunk/libs/unordered/test/unordered/compile_map.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/compile_map.cpp (original)
+++ trunk/libs/unordered/test/unordered/compile_map.cpp 2012-08-25 17:56:16 EDT (Sat, 25 Aug 2012)
@@ -32,13 +32,13 @@
 
 template class boost::unordered_map<
     test::minimal::assignable,
- test::minimal::default_copy_constructible,
+ test::minimal::default_assignable,
     test::minimal::hash<test::minimal::assignable>,
     test::minimal::equal_to<test::minimal::assignable>,
     test::minimal::allocator<test::minimal::assignable> >;
 template class boost::unordered_multimap<
     test::minimal::assignable,
- test::minimal::copy_constructible,
+ test::minimal::assignable,
     test::minimal::hash<test::minimal::assignable>,
     test::minimal::equal_to<test::minimal::assignable>,
     test::minimal::allocator<test::minimal::assignable> >;
@@ -48,7 +48,7 @@
     test::minimal::constructor_param x;
 
     typedef std::pair<test::minimal::assignable const,
- test::minimal::copy_constructible> value_type;
+ test::minimal::assignable> value_type;
     value_type value(x, x);
 
     std::cout<<"Test unordered_map.\n";
@@ -62,7 +62,7 @@
 
     boost::unordered_map<
         test::minimal::assignable,
- test::minimal::copy_constructible,
+ test::minimal::assignable,
         test::minimal::hash<test::minimal::assignable>,
         test::minimal::equal_to<test::minimal::assignable>,
         test::minimal::allocator<value_type> > map;
@@ -82,7 +82,7 @@
 
     boost::unordered_multimap<
         test::minimal::assignable,
- test::minimal::copy_constructible,
+ test::minimal::assignable,
         test::minimal::hash<test::minimal::assignable>,
         test::minimal::equal_to<test::minimal::assignable>,
         test::minimal::allocator<value_type> > multimap;
@@ -95,7 +95,7 @@
 UNORDERED_AUTO_TEST(equality_tests) {
     typedef std::pair<
             test::minimal::copy_constructible_equality_comparable const,
- test::minimal::copy_constructible> value_type;
+ test::minimal::copy_constructible_equality_comparable> value_type;
 
     boost::unordered_map<int, int> int_map;
 
@@ -187,44 +187,44 @@
     test::minimal::equal_to<test::minimal::assignable> equal_to(x);
 
     typedef std::pair<test::minimal::assignable const,
- test::minimal::copy_constructible> map_value_type;
- map_value_type map_value(assignable, copy_constructible);
+ test::minimal::assignable> map_value_type;
+ map_value_type map_value(assignable, assignable);
 
     std::cout<<"Test unordered_map.\n";
 
     boost::unordered_map<
         test::minimal::assignable,
- test::minimal::copy_constructible,
+ test::minimal::assignable,
         test::minimal::hash<test::minimal::assignable>,
         test::minimal::equal_to<test::minimal::assignable>,
         test::minimal::allocator<map_value_type> > map;
 
     unordered_unique_test(map, map_value);
- unordered_map_test(map, assignable, copy_constructible);
+ unordered_map_test(map, assignable, assignable);
     unordered_copyable_test(map, assignable, map_value, hash, equal_to);
 
     boost::unordered_map<
         test::minimal::assignable,
- test::minimal::default_copy_constructible,
+ test::minimal::default_assignable,
         test::minimal::hash<test::minimal::assignable>,
         test::minimal::equal_to<test::minimal::assignable>,
         test::minimal::allocator<map_value_type> > map2;
 
- test::minimal::default_copy_constructible default_copy_constructible;
+ test::minimal::default_assignable default_assignable;
 
- unordered_map_functions(map2, assignable, default_copy_constructible);
+ unordered_map_functions(map2, assignable, default_assignable);
 
     std::cout<<"Test unordered_multimap.\n";
 
     boost::unordered_multimap<
         test::minimal::assignable,
- test::minimal::copy_constructible,
+ test::minimal::assignable,
         test::minimal::hash<test::minimal::assignable>,
         test::minimal::equal_to<test::minimal::assignable>,
         test::minimal::allocator<map_value_type> > multimap;
 
     unordered_equivalent_test(multimap, map_value);
- unordered_map_test(multimap, assignable, copy_constructible);
+ unordered_map_test(multimap, assignable, assignable);
     unordered_copyable_test(multimap, assignable, map_value, hash, equal_to);
 }
 


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