2006-05-17 17:19:16 +00:00
|
|
|
|
2010-10-23 12:02:18 +00:00
|
|
|
// Copyright 2006-2010 Daniel James.
|
2006-07-01 22:31:26 +00:00
|
|
|
// 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)
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2009-11-28 11:40:08 +00:00
|
|
|
#include "../helpers/prefix.hpp"
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
#include <boost/unordered_set.hpp>
|
|
|
|
|
#include <boost/unordered_map.hpp>
|
2008-03-24 17:03:15 +00:00
|
|
|
#include "../helpers/test.hpp"
|
2006-05-17 17:19:16 +00:00
|
|
|
#include <boost/next_prior.hpp>
|
|
|
|
|
#include "../objects/test.hpp"
|
|
|
|
|
#include "../helpers/random_values.hpp"
|
|
|
|
|
#include "../helpers/tracker.hpp"
|
|
|
|
|
#include "../helpers/equivalent.hpp"
|
|
|
|
|
#include "../helpers/invariants.hpp"
|
2006-08-06 20:42:45 +00:00
|
|
|
#include "../helpers/input_iterator.hpp"
|
2006-05-17 17:19:16 +00:00
|
|
|
|
|
|
|
|
#include <iostream>
|
2008-04-17 07:39:24 +00:00
|
|
|
|
|
|
|
|
namespace insert_tests {
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2007-12-06 11:42:28 +00:00
|
|
|
test::seed_t seed(243432);
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void unique_insert_tests1(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2008-01-10 22:30:46 +00:00
|
|
|
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
|
2006-06-12 23:30:46 +00:00
|
|
|
typedef test::ordered<X> ordered;
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
std::cerr<<"insert(value) tests for containers with unique keys.\n";
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
|
|
|
|
test::ordered<X> tracker = test::create_ordered(x);
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2008-01-10 22:30:46 +00:00
|
|
|
|
|
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it = v.begin();
|
2006-05-17 17:19:16 +00:00
|
|
|
it != v.end(); ++it)
|
|
|
|
|
{
|
2008-01-10 22:30:46 +00:00
|
|
|
|
|
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
2006-06-12 23:30:46 +00:00
|
|
|
std::pair<iterator, bool> r1 = x.insert(*it);
|
2010-01-08 05:39:54 +00:00
|
|
|
std::pair<BOOST_DEDUCED_TYPENAME ordered::iterator, bool>
|
|
|
|
|
r2 = tracker.insert(*it);
|
2006-05-17 17:19:16 +00:00
|
|
|
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(r1.second == r2.second);
|
|
|
|
|
BOOST_TEST(*r1.first == *r2.first);
|
2006-05-17 17:19:16 +00:00
|
|
|
|
|
|
|
|
tracker.compare_key(x, *it);
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void equivalent_insert_tests1(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
|
|
|
|
std::cerr<<"insert(value) tests for containers with equivalent keys.\n";
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
|
|
|
|
test::ordered<X> tracker = test::create_ordered(x);
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2008-01-10 22:30:46 +00:00
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it = v.begin();
|
2006-05-17 17:19:16 +00:00
|
|
|
it != v.end(); ++it)
|
|
|
|
|
{
|
2008-01-10 22:30:46 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
2008-01-10 22:30:46 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::iterator r1 = x.insert(*it);
|
2010-01-08 05:39:54 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME test::ordered<X>::iterator r2
|
|
|
|
|
= tracker.insert(*it);
|
2006-05-17 17:19:16 +00:00
|
|
|
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(*r1 == *r2);
|
2006-05-17 17:19:16 +00:00
|
|
|
|
|
|
|
|
tracker.compare_key(x, *it);
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void insert_tests2(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2008-01-10 22:30:46 +00:00
|
|
|
typedef BOOST_DEDUCED_TYPENAME test::ordered<X> tracker_type;
|
|
|
|
|
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
|
|
|
|
|
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
|
|
|
|
|
typedef BOOST_DEDUCED_TYPENAME tracker_type::iterator tracker_iterator;
|
2006-05-17 17:19:16 +00:00
|
|
|
|
|
|
|
|
std::cerr<<"insert(begin(), value) tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
2006-05-17 17:19:16 +00:00
|
|
|
tracker_type tracker = test::create_ordered(x);
|
|
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2010-01-08 05:39:54 +00:00
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator
|
|
|
|
|
it = v.begin(); it != v.end(); ++it)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2010-01-08 05:39:54 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type
|
|
|
|
|
old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
iterator r1 = x.insert(x.begin(), *it);
|
|
|
|
|
tracker_iterator r2 = tracker.insert(tracker.begin(), *it);
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(*r1 == *r2);
|
2006-05-17 17:19:16 +00:00
|
|
|
tracker.compare_key(x, *it);
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::cerr<<"insert(end(), value) tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
|
|
|
|
X const& x_const = x;
|
2006-05-17 17:19:16 +00:00
|
|
|
tracker_type tracker = test::create_ordered(x);
|
|
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(100, generator);
|
2010-01-08 05:39:54 +00:00
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator
|
|
|
|
|
it = v.begin(); it != v.end(); ++it)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2010-01-08 05:39:54 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type
|
|
|
|
|
old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
const_iterator r1 = x.insert(x_const.end(), *it);
|
|
|
|
|
tracker_iterator r2 = tracker.insert(tracker.end(), *it);
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(*r1 == *r2);
|
2006-05-17 17:19:16 +00:00
|
|
|
tracker.compare_key(x, *it);
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::cerr<<"insert(pos, value) tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
2006-05-17 17:19:16 +00:00
|
|
|
const_iterator pos = x.begin();
|
|
|
|
|
tracker_type tracker = test::create_ordered(x);
|
|
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2010-01-08 05:39:54 +00:00
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator
|
|
|
|
|
it = v.begin(); it != v.end(); ++it)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2010-01-08 05:39:54 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type
|
|
|
|
|
old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
pos = x.insert(pos, *it);
|
|
|
|
|
tracker_iterator r2 = tracker.insert(tracker.begin(), *it);
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(*pos == *r2);
|
2006-05-17 17:19:16 +00:00
|
|
|
tracker.compare_key(x, *it);
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::cerr<<"insert single item range tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
2006-05-17 17:19:16 +00:00
|
|
|
tracker_type tracker = test::create_ordered(x);
|
|
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2010-01-08 05:39:54 +00:00
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator
|
|
|
|
|
it = v.begin(); it != v.end(); ++it)
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2010-01-08 05:39:54 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type
|
|
|
|
|
old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
x.insert(it, boost::next(it));
|
|
|
|
|
tracker.insert(*it);
|
|
|
|
|
tracker.compare_key(x, *it);
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::cerr<<"insert range tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2006-05-17 17:19:16 +00:00
|
|
|
x.insert(v.begin(), v.end());
|
|
|
|
|
|
2006-10-31 22:19:26 +00:00
|
|
|
test::check_container(x, v);
|
2006-05-17 17:19:16 +00:00
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
2006-08-06 20:42:45 +00:00
|
|
|
|
|
|
|
|
std::cerr<<"insert input iterator range tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
X x;
|
|
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2009-12-07 19:26:26 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME test::random_values<X>::const_iterator
|
|
|
|
|
begin = v.begin(), end = v.end();
|
|
|
|
|
x.insert(test::input_iterator(begin), test::input_iterator(end));
|
2006-08-06 20:42:45 +00:00
|
|
|
test::check_container(x, v);
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
2010-10-23 12:02:18 +00:00
|
|
|
|
|
|
|
|
std::cerr<<"insert copy iterator range tests.\n";
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
X x;
|
|
|
|
|
|
|
|
|
|
test::random_values<X> v(1000, generator);
|
|
|
|
|
x.insert(test::copy_iterator(v.begin()), test::copy_iterator(v.end()));
|
|
|
|
|
test::check_container(x, v);
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
|
|
|
|
|
2010-02-25 19:05:01 +00:00
|
|
|
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
|
|
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void unique_emplace_tests1(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
{
|
|
|
|
|
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
|
|
|
|
|
typedef test::ordered<X> ordered;
|
|
|
|
|
|
|
|
|
|
std::cerr<<"emplace(value) tests for containers with unique keys.\n";
|
|
|
|
|
|
|
|
|
|
X x;
|
|
|
|
|
test::ordered<X> tracker = test::create_ordered(x);
|
|
|
|
|
|
|
|
|
|
test::random_values<X> v(1000, generator);
|
|
|
|
|
|
|
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it = v.begin();
|
|
|
|
|
it != v.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
|
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
|
|
|
|
std::pair<iterator, bool> r1 = x.emplace(*it);
|
2010-01-08 05:39:54 +00:00
|
|
|
std::pair<BOOST_DEDUCED_TYPENAME ordered::iterator, bool>
|
|
|
|
|
r2 = tracker.insert(*it);
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(r1.second == r2.second);
|
|
|
|
|
BOOST_TEST(*r1.first == *r2.first);
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
|
|
|
|
|
tracker.compare_key(x, *it);
|
|
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void equivalent_emplace_tests1(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
{
|
|
|
|
|
std::cerr<<"emplace(value) tests for containers with equivalent keys.\n";
|
|
|
|
|
|
|
|
|
|
X x;
|
|
|
|
|
test::ordered<X> tracker = test::create_ordered(x);
|
|
|
|
|
|
|
|
|
|
test::random_values<X> v(1000, generator);
|
|
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it = v.begin();
|
|
|
|
|
it != v.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
|
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
|
|
|
|
BOOST_DEDUCED_TYPENAME X::iterator r1 = x.emplace(*it);
|
2010-01-08 05:39:54 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME test::ordered<X>::iterator
|
|
|
|
|
r2 = tracker.insert(*it);
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(*r1 == *r2);
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
|
|
|
|
|
tracker.compare_key(x, *it);
|
|
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
template <class X>
|
2008-01-20 18:55:57 +00:00
|
|
|
void map_tests(X*, test::random_generator generator = test::default_generator)
|
2006-05-21 17:14:11 +00:00
|
|
|
{
|
2006-10-31 22:19:26 +00:00
|
|
|
std::cerr<<"map tests.\n";
|
|
|
|
|
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
|
|
|
|
test::ordered<X> tracker = test::create_ordered(x);
|
|
|
|
|
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2008-01-10 22:30:46 +00:00
|
|
|
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it = v.begin();
|
2006-05-21 17:14:11 +00:00
|
|
|
it != v.end(); ++it)
|
|
|
|
|
{
|
2008-01-10 22:30:46 +00:00
|
|
|
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
2006-05-21 17:14:11 +00:00
|
|
|
float b = x.max_load_factor();
|
|
|
|
|
|
|
|
|
|
x[it->first] = it->second;
|
|
|
|
|
tracker[it->first] = it->second;
|
|
|
|
|
|
|
|
|
|
tracker.compare_key(x, *it);
|
|
|
|
|
|
|
|
|
|
if(x.size() < b * old_bucket_count)
|
Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
Better configuration for boost.unordered.
........
r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
Add explicit destructors to the unordered containers. Refs #2908.
Isn't really needed but it doesn't hurt.
........
r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
Unordered change log for explicit destructors.
........
r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
Missing changelog entry.
........
r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
Use lightweight_test for unordered.
........
r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
Some workarounds for old versions of Borland.
........
r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
Fix a change accidentally included in the last commit.
........
r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
Remove an unused function.
........
[SVN r53465]
2009-05-30 17:34:12 +00:00
|
|
|
BOOST_TEST(x.bucket_count() == old_bucket_count);
|
2006-05-21 17:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-08 05:39:54 +00:00
|
|
|
// Some tests for when the range's value type doesn't match the container's
|
|
|
|
|
// value type.
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
|
2006-10-31 22:19:26 +00:00
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void map_insert_range_test1(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
2006-10-31 22:19:26 +00:00
|
|
|
{
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
std::cerr<<"map_insert_range_test1\n";
|
2006-10-31 22:19:26 +00:00
|
|
|
|
2010-01-08 05:39:54 +00:00
|
|
|
typedef test::list<
|
|
|
|
|
std::pair<
|
|
|
|
|
BOOST_DEDUCED_TYPENAME X::key_type,
|
|
|
|
|
BOOST_DEDUCED_TYPENAME X::mapped_type
|
|
|
|
|
>
|
|
|
|
|
> list;
|
2008-01-20 18:55:57 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
Merge in support for equality operators for the unordered containers and
hopefully better cross-platform support.
Merged revisions 44778-44835,44837-44918 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44778 | danieljames | 2008-04-26 17:15:44 +0100 (Sat, 26 Apr 2008) | 2 lines
Remove a trailing comma.
........
r44779 | danieljames | 2008-04-26 17:23:51 +0100 (Sat, 26 Apr 2008) | 1 line
Merge in support for equality operators.
........
r44780 | danieljames | 2008-04-26 17:28:44 +0100 (Sat, 26 Apr 2008) | 1 line
Use my own list container to avoid working around STL container bugs.
........
r44833 | danieljames | 2008-04-28 08:03:43 +0100 (Mon, 28 Apr 2008) | 1 line
Better equality tests.
........
r44834 | danieljames | 2008-04-28 08:04:03 +0100 (Mon, 28 Apr 2008) | 1 line
Remove a superfluous check.
........
r44835 | danieljames | 2008-04-28 08:04:21 +0100 (Mon, 28 Apr 2008) | 1 line
Add equality reference documentation.
........
r44916 | danieljames | 2008-04-30 08:16:52 +0100 (Wed, 30 Apr 2008) | 1 line
New version of list.hpp
........
r44917 | danieljames | 2008-04-30 08:18:31 +0100 (Wed, 30 Apr 2008) | 1 line
Support compilers without ADL in the compile tests.
........
r44918 | danieljames | 2008-04-30 08:25:20 +0100 (Wed, 30 Apr 2008) | 7 lines
Change the typedef of buffered functions as it was confusing MSVC 6.5
get_allocator wasn't compiling when the allocator workaround is used because it
couldn't cast from the wrapped allocator to an allocator of another type. So
use value_alloc_ when it's available (it's only unavailable on compilers with
C++0x support, which don't require the workaround).
........
[SVN r44919]
2008-04-30 07:57:04 +00:00
|
|
|
list l(v.begin(), v.end());
|
2006-10-31 22:19:26 +00:00
|
|
|
|
|
|
|
|
X x; x.insert(l.begin(), l.end());
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
template <class X>
|
2010-01-08 05:39:54 +00:00
|
|
|
void map_insert_range_test2(X*,
|
|
|
|
|
test::random_generator generator = test::default_generator)
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
{
|
|
|
|
|
std::cerr<<"map_insert_range_test2\n";
|
|
|
|
|
|
2010-01-08 05:39:54 +00:00
|
|
|
typedef test::list<
|
|
|
|
|
std::pair<BOOST_DEDUCED_TYPENAME X::key_type const, int>
|
|
|
|
|
> list;
|
|
|
|
|
test::random_values<
|
|
|
|
|
boost::unordered_map<BOOST_DEDUCED_TYPENAME X::key_type, int>
|
|
|
|
|
> v(1000, generator);
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
list l(v.begin(), v.end());
|
|
|
|
|
|
|
|
|
|
X x; x.insert(l.begin(), l.end());
|
|
|
|
|
|
|
|
|
|
test::check_equivalent_keys(x);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-08 05:39:54 +00:00
|
|
|
boost::unordered_set<test::object,
|
|
|
|
|
test::hash, test::equal_to,
|
|
|
|
|
test::allocator<test::object> >* test_set;
|
|
|
|
|
boost::unordered_multiset<test::object,
|
|
|
|
|
test::hash, test::equal_to,
|
|
|
|
|
test::allocator<test::object> >* test_multiset;
|
|
|
|
|
boost::unordered_map<test::object, test::object,
|
|
|
|
|
test::hash, test::equal_to,
|
|
|
|
|
test::allocator<test::object> >* test_map;
|
|
|
|
|
boost::unordered_multimap<test::object, test::object,
|
|
|
|
|
test::hash, test::equal_to,
|
|
|
|
|
test::allocator<test::object> >* test_multimap;
|
2008-04-17 07:39:24 +00:00
|
|
|
|
|
|
|
|
using test::default_generator;
|
|
|
|
|
using test::generate_collisions;
|
|
|
|
|
|
|
|
|
|
UNORDERED_TEST(unique_insert_tests1,
|
|
|
|
|
((test_set)(test_map))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
UNORDERED_TEST(equivalent_insert_tests1,
|
|
|
|
|
((test_multiset)(test_multimap))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
UNORDERED_TEST(insert_tests2,
|
|
|
|
|
((test_set)(test_multiset)(test_map)(test_multimap))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
2010-02-25 19:05:01 +00:00
|
|
|
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
UNORDERED_TEST(unique_emplace_tests1,
|
|
|
|
|
((test_set)(test_map))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
UNORDERED_TEST(equivalent_emplace_tests1,
|
|
|
|
|
((test_multiset)(test_multimap))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-04-17 07:39:24 +00:00
|
|
|
UNORDERED_TEST(map_tests,
|
|
|
|
|
((test_map))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
UNORDERED_TEST(map_insert_range_test1,
|
|
|
|
|
((test_map)(test_multimap))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
UNORDERED_TEST(map_insert_range_test2,
|
2008-04-17 07:39:24 +00:00
|
|
|
((test_map)(test_multimap))
|
|
|
|
|
((default_generator)(generate_collisions))
|
|
|
|
|
)
|
|
|
|
|
|
2009-11-20 09:16:36 +00:00
|
|
|
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && \
|
|
|
|
|
!defined(BOOST_NO_INITIALIZER_LISTS)
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
|
|
|
|
|
UNORDERED_AUTO_TEST(insert_initializer_list_set)
|
|
|
|
|
{
|
|
|
|
|
boost::unordered_set<int> set;
|
|
|
|
|
set.insert({1,2,3,1});
|
|
|
|
|
BOOST_TEST_EQ(set.size(), 3u);
|
|
|
|
|
BOOST_TEST(set.find(1) != set.end());
|
|
|
|
|
BOOST_TEST(set.find(4) == set.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UNORDERED_AUTO_TEST(insert_initializer_list_multiset)
|
|
|
|
|
{
|
|
|
|
|
boost::unordered_multiset<std::string> multiset;
|
2009-10-27 19:39:33 +00:00
|
|
|
//multiset.insert({});
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
BOOST_TEST(multiset.empty());
|
|
|
|
|
multiset.insert({"a"});
|
|
|
|
|
BOOST_TEST_EQ(multiset.size(), 1u);
|
|
|
|
|
BOOST_TEST(multiset.find("a") != multiset.end());
|
|
|
|
|
BOOST_TEST(multiset.find("b") == multiset.end());
|
|
|
|
|
multiset.insert({"a","b"});
|
|
|
|
|
BOOST_TEST(multiset.size() == 3);
|
|
|
|
|
BOOST_TEST_EQ(multiset.count("a"), 2u);
|
|
|
|
|
BOOST_TEST_EQ(multiset.count("b"), 1u);
|
|
|
|
|
BOOST_TEST_EQ(multiset.count("c"), 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UNORDERED_AUTO_TEST(insert_initializer_list_map)
|
|
|
|
|
{
|
|
|
|
|
boost::unordered_map<std::string, std::string> map;
|
2009-10-27 19:39:33 +00:00
|
|
|
//map.insert({});
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
BOOST_TEST(map.empty());
|
|
|
|
|
map.insert({{"a", "b"},{"a", "b"},{"d", ""}});
|
|
|
|
|
BOOST_TEST_EQ(map.size(), 2u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UNORDERED_AUTO_TEST(insert_initializer_list_multimap)
|
|
|
|
|
{
|
|
|
|
|
boost::unordered_multimap<std::string, std::string> multimap;
|
2009-10-27 19:39:33 +00:00
|
|
|
//multimap.insert({});
|
Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
Try supporting reference parameters in pairs. Probably not required.
........
r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
Just remove the test since the test itself doesn't work on most compilers.
........
r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
Fix the iterator category.
........
r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
Update reference docs to latest version of draft standard and fill in
some missing details.
........
r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
Stricter insert exception tests.
........
r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
Insert using initializer lists.
........
r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
Update the unordered rationale.
........
r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
Make sure inserting from a range of types other than the value type is better tested.
........
[SVN r56700]
2009-10-10 13:52:53 +00:00
|
|
|
BOOST_TEST(multimap.empty());
|
|
|
|
|
multimap.insert({{"a", "b"},{"a", "b"},{"d", ""}});
|
|
|
|
|
BOOST_TEST_EQ(multimap.size(), 3u);
|
|
|
|
|
BOOST_TEST_EQ(multimap.count("a"), 2u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
}
|
2008-04-17 07:39:24 +00:00
|
|
|
|
|
|
|
|
RUN_TESTS()
|