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]
This commit is contained in:
Daniel James
2008-04-30 07:57:04 +00:00
parent 94932ae026
commit b5db48b6a4
21 changed files with 745 additions and 99 deletions

View File

@@ -8,7 +8,7 @@
#include <boost/unordered_map.hpp>
#include "../helpers/test.hpp"
#include <list>
#include "../helpers/list.hpp"
#include <set>
#include <iostream>
#include <iterator>
@@ -50,7 +50,7 @@ typedef boost::unordered_multimap<int, int,
collision2_hash, std::equal_to<int>,
test::allocator<std::pair<int const, int> > > collide_map2;
typedef collide_map::value_type collide_value;
typedef std::list<collide_value> collide_list;
typedef test::list<collide_value> collide_list;
UNORDERED_AUTO_TEST(empty_range_tests)
{
@@ -108,10 +108,8 @@ UNORDERED_AUTO_TEST(two_equivalent_item_tests)
template<class Range1, class Range2>
bool compare(Range1 const& x, Range2 const& y)
{
collide_list a;
collide_list b;
std::copy(x.begin(), x.end(), std::back_inserter(a));
std::copy(y.begin(), y.end(), std::back_inserter(b));
collide_list a(x.begin(), x.end());
collide_list b(y.begin(), y.end());
a.sort();
b.sort();
return a == b;
@@ -120,8 +118,7 @@ bool compare(Range1 const& x, Range2 const& y)
template <class Container>
bool general_erase_range_test(Container& x, int start, int end)
{
collide_list l;
std::copy(x.begin(), x.end(), std::back_inserter(l));
collide_list l(x.begin(), x.end());
l.erase(boost::next(l.begin(), start), boost::next(l.begin(), end));
x.erase(boost::next(x.begin(), start), boost::next(x.begin(), end));
return compare(l, x);
@@ -133,8 +130,7 @@ void erase_subrange_tests(Container const& x)
for(std::size_t length = 0; length < x.size(); ++length) {
for(std::size_t position = 0; position < x.size() - length; ++position) {
Container y(x);
collide_list init;
std::copy(y.begin(), y.end(), std::back_inserter(init));
collide_list init(y.begin(), y.end());
if(!general_erase_range_test(y, position, position + length)) {
BOOST_ERROR("general_erase_range_test failed.");
std::cout<<"Erase: ["<<position<<","<<position + length<<")\n";