forked from boostorg/unordered
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:
@@ -28,7 +28,7 @@ template <class T> void sink(T const&) {}
|
||||
template <class T> T rvalue(T const& v) { return v; }
|
||||
|
||||
template <class X, class T>
|
||||
void container_test(X& r, T&)
|
||||
void container_test(X& r, T const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
|
||||
@@ -121,8 +121,6 @@ void container_test(X& r, T&)
|
||||
test::check_return_type<const_iterator>::equals(a.cend());
|
||||
test::check_return_type<const_iterator>::equals(a_const.cend());
|
||||
|
||||
// No tests for ==, != since they're not required for unordered containers.
|
||||
|
||||
a.swap(b);
|
||||
test::check_return_type<X>::equals_ref(r = a);
|
||||
test::check_return_type<size_type>::equals(a.size());
|
||||
@@ -161,6 +159,20 @@ void unordered_map_test(X& r, Key const& k, T const& v)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class X>
|
||||
void equality_test(X& r)
|
||||
{
|
||||
X const a = r, b = r;
|
||||
|
||||
test::check_return_type<bool>::equals(a == b);
|
||||
test::check_return_type<bool>::equals(a != b);
|
||||
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
test::check_return_type<std::size_t>::equals(boost::hash_value(a));
|
||||
#else
|
||||
test::check_return_type<std::size_t>::equals(hash_value(a));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class X, class T>
|
||||
void unordered_unique_test(X& r, T const& t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user