Skip to content

Commit

Permalink
Unordered: Fix incorrect assertion.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.boost.org/svn/boost/trunk@80508 b8fc166d-592f-0410-95f2-cb63ce0dd405
  • Loading branch information
danieljames committed Sep 12, 2012
1 parent d267408 commit 95395e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion boost/unordered/detail/equivalent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ namespace boost { namespace unordered { namespace detail {
// strong otherwise exception safety
void rehash_impl(std::size_t num_buckets)
{
BOOST_ASSERT(this->size_);
BOOST_ASSERT(this->buckets_);

this->create_buckets(num_buckets);
previous_pointer prev = this->get_previous_start();
Expand Down
2 changes: 1 addition & 1 deletion boost/unordered/detail/unique.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ namespace boost { namespace unordered { namespace detail {
// strong otherwise exception safety
void rehash_impl(std::size_t num_buckets)
{
BOOST_ASSERT(this->size_);
BOOST_ASSERT(this->buckets_);

this->create_buckets(num_buckets);
previous_pointer prev = this->get_previous_start();
Expand Down
18 changes: 18 additions & 0 deletions libs/unordered/test/unordered/insert_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,24 @@ void insert_tests2(X*, test::random_generator generator)
test::check_equivalent_keys(x);
}

std::cerr<<"insert range with rehash tests.\n";

{
test::check_instances check_;

X x;

test::random_values<X> v(1000, generator);

x.insert(*v.begin());
x.clear();

x.insert(v.begin(), v.end());

test::check_container(x, v);
test::check_equivalent_keys(x);
}

std::cerr<<"insert input iterator range tests.\n";

{
Expand Down

0 comments on commit 95395e2

Please sign in to comment.