Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74932 - in branches/release: boost/unordered boost/unordered/detail libs/unordered libs/unordered/doc libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-10-12 18:30:03


Author: danieljames
Date: 2011-10-12 18:30:02 EDT (Wed, 12 Oct 2011)
New Revision: 74932
URL: http://svn.boost.org/trac/boost/changeset/74932

Log:
Unordered: merge from trunk.
Properties modified:
   branches/release/boost/unordered/ (props changed)
   branches/release/libs/unordered/ (props changed)
Text files modified:
   branches/release/boost/unordered/detail/allocator_helpers.hpp | 5 +-
   branches/release/boost/unordered/detail/emplace_args.hpp | 16 ++++----
   branches/release/libs/unordered/doc/comparison.qbk | 9 +---
   branches/release/libs/unordered/test/unordered/move_tests.cpp | 69 ++++++++++++++++++++++++++++++++++++++++
   4 files changed, 83 insertions(+), 16 deletions(-)

Modified: branches/release/boost/unordered/detail/allocator_helpers.hpp
==============================================================================
--- branches/release/boost/unordered/detail/allocator_helpers.hpp (original)
+++ branches/release/boost/unordered/detail/allocator_helpers.hpp 2011-10-12 18:30:02 EDT (Wed, 12 Oct 2011)
@@ -104,7 +104,8 @@
     yes_type is_private_type(private_type const&);
 
     struct convert_from_anything {
- convert_from_anything(...);
+ template <typename T>
+ convert_from_anything(T const&);
     };
 
 #if !defined(BOOST_NO_SFINAE_EXPR) || BOOST_WORKAROUND(BOOST_MSVC, >= 1500)
@@ -339,7 +340,7 @@
             boost::unordered::detail::has_max_size<Alloc>::value, SizeType
>::type call_max_size(const Alloc&)
     {
- return std::numeric_limits<SizeType>::max();
+ return (std::numeric_limits<SizeType>::max)();
     }
 
     template <typename Alloc>

Modified: branches/release/boost/unordered/detail/emplace_args.hpp
==============================================================================
--- branches/release/boost/unordered/detail/emplace_args.hpp (original)
+++ branches/release/boost/unordered/detail/emplace_args.hpp 2011-10-12 18:30:02 EDT (Wed, 12 Oct 2011)
@@ -223,29 +223,29 @@
 #if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
     template <typename A, typename B, typename A0>
     struct emulation1 {
- static choice1::type check(choice1, std::pair<A, B> const&);
- static choice2::type check(choice2, A const&);
- static choice3::type check(choice3, ...);
+ static choice1::type test(choice1, std::pair<A, B> const&);
+ static choice2::type test(choice2, A const&);
+ static choice3::type test(choice3, convert_from_anything const&);
 
         enum { value =
- sizeof(check(choose(), boost::unordered::detail::make<A0>())) ==
+ sizeof(test(choose(), boost::unordered::detail::make<A0>())) ==
                 sizeof(choice2::type) };
     };
 #endif
 
     template <typename A, typename B, typename A0>
     struct check3_base {
- static choice1::type check(choice1,
+ static choice1::type test(choice1,
             boost::unordered::piecewise_construct_t);
 
 #if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
- static choice2::type check(choice2, A const&);
+ static choice2::type test(choice2, A const&);
 #endif
 
- static choice3::type check(choice3, ...);
+ static choice3::type test(choice3, ...);
 
         enum { value =
- sizeof(check(choose(), boost::unordered::detail::make<A0>())) };
+ sizeof(test(choose(), boost::unordered::detail::make<A0>())) };
     };
 
     template <typename A, typename B, typename A0>

Modified: branches/release/libs/unordered/doc/comparison.qbk
==============================================================================
--- branches/release/libs/unordered/doc/comparison.qbk (original)
+++ branches/release/libs/unordered/doc/comparison.qbk 2011-10-12 18:30:02 EDT (Wed, 12 Oct 2011)
@@ -1,4 +1,4 @@
-[/ Copyright 2006-2008 Daniel James.
+[/ Copyright 2006-2011 Daniel James.
  / Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
 
@@ -66,15 +66,12 @@
     [
         [No equivalent]
         [Local iterators can be used to iterate through individual buckets.
- (I don't think that the order of local iterators and iterators are
+ (The order of local iterators and iterators aren't
             required to have any correspondence.)]
     ]
     [
         [Can be compared using the `==`, `!=`, `<`, `<=`, `>`, `>=` operators.]
- [No comparison operators are defined in the standard, although
- [link unordered.rationale.equality_operators
- implementations might extend the containers to support `==` and
- `!=`].]
+ [Can be compared using the `==` and `!=` operators.]
     ]
     [
         []

Modified: branches/release/libs/unordered/test/unordered/move_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/move_tests.cpp (original)
+++ branches/release/libs/unordered/test/unordered/move_tests.cpp 2011-10-12 18:30:02 EDT (Wed, 12 Oct 2011)
@@ -193,12 +193,15 @@
             test::check_container(y, v2);
             test::check_equivalent_keys(y);
             BOOST_TEST(y.max_load_factor() == 2.0);
+
+#if defined(BOOST_HAS_NRVO)
             if (allocator_type::is_propagate_on_move) {
                 BOOST_TEST(test::equivalent(y.get_allocator(), al2));
             }
             else {
                 BOOST_TEST(test::equivalent(y.get_allocator(), al1));
             }
+#endif
         }
 
         {
@@ -214,6 +217,72 @@
             test::check_container(y, v);
             test::check_equivalent_keys(y);
             BOOST_TEST(y.max_load_factor() == 0.5);
+
+#if defined(BOOST_HAS_NRVO)
+ if (allocator_type::is_propagate_on_move) {
+ BOOST_TEST(test::equivalent(y.get_allocator(), al2));
+ }
+ else {
+ BOOST_TEST(test::equivalent(y.get_allocator(), al1));
+ }
+#endif
+ }
+
+ {
+ test::check_instances check_;
+
+ test::random_values<T> v(500, generator);
+ T y(0, hf, eq, al1);
+
+ T x(0, hf, eq, al2);
+ x.max_load_factor(0.25);
+ x.insert(v.begin(), v.end());
+
+ test::object_count count = test::global_object_count;
+ y = boost::move(x);
+ if (allocator_type::is_propagate_on_move) {
+ BOOST_TEST(count == test::global_object_count);
+ }
+ test::check_container(y, v);
+ test::check_equivalent_keys(y);
+ BOOST_TEST(y.max_load_factor() == 0.25);
+
+ if (allocator_type::is_propagate_on_move) {
+ BOOST_TEST(test::equivalent(y.get_allocator(), al2));
+ }
+ else {
+ BOOST_TEST(test::equivalent(y.get_allocator(), al1));
+ }
+ }
+
+ {
+ test::check_instances check_;
+
+ test::random_values<T> v1(1000, generator);
+ test::random_values<T> v2(200, generator);
+
+ T x(0, hf, eq, al2);
+ x.max_load_factor(0.5);
+ x.insert(v2.begin(), v2.end());
+
+ test::object_count count1 = test::global_object_count;
+
+ T y(v1.begin(), v1.end(), 0, hf, eq, al1);
+ y = boost::move(x);
+
+ test::object_count count2 = test::global_object_count;
+
+ if (allocator_type::is_propagate_on_move) {
+ BOOST_TEST(count1.instances ==
+ test::global_object_count.instances);
+ BOOST_TEST(count2.constructions ==
+ test::global_object_count.constructions);
+ }
+
+ test::check_container(y, v2);
+ test::check_equivalent_keys(y);
+ BOOST_TEST(y.max_load_factor() == 0.5);
+
             if (allocator_type::is_propagate_on_move) {
                 BOOST_TEST(test::equivalent(y.get_allocator(), al2));
             }


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