From e64f82ed03ed22f5ce150d127b1f98b1f571c9ab Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 8 Apr 2012 15:29:49 +0000 Subject: [PATCH] Unordered: Fix equality for multimap/multiset. [SVN r77833] --- include/boost/unordered/detail/equivalent.hpp | 2 +- test/unordered/equality_tests.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/boost/unordered/detail/equivalent.hpp b/include/boost/unordered/detail/equivalent.hpp index 7ee0ba31..8448cc33 100644 --- a/include/boost/unordered/detail/equivalent.hpp +++ b/include/boost/unordered/detail/equivalent.hpp @@ -330,7 +330,7 @@ namespace boost { namespace unordered { namespace detail { } node_pointer start = n1; - for(;n1 != end2; n1 = static_cast(n1->next_)) + for(;n1 != end1; n1 = static_cast(n1->next_)) { value_type const& v = n1->value(); if (find(start, n1, v)) continue; diff --git a/test/unordered/equality_tests.cpp b/test/unordered/equality_tests.cpp index 317a40f4..b6d146c6 100644 --- a/test/unordered/equality_tests.cpp +++ b/test/unordered/equality_tests.cpp @@ -150,6 +150,14 @@ namespace equality_tests ((1)(2))((1001)(1)), !=, ((1001)(2))((1)(1))) } + UNORDERED_AUTO_TEST(equality_multiple_group_test) + { + UNORDERED_EQUALITY_MULTISET_TEST( + (1)(1)(1)(1001)(2001)(2001)(2)(1002)(3)(1003)(2003), ==, + (3)(1003)(2003)(1002)(2)(2001)(2001)(1)(1001)(1)(1) + ); + } + // Test that equality still works when the two containers have // different hash functions but the same equality predicate. @@ -168,7 +176,6 @@ namespace equality_tests set1.insert(20); set2.insert(10); BOOST_TEST(set1 == set2); } - } RUN_TESTS()