2006-03-19 22:24:06 +00:00
|
|
|
|
2009-03-09 20:56:23 +00:00
|
|
|
// Copyright 2006-2009 Daniel James.
|
2023-02-14 09:38:08 -08:00
|
|
|
// Copyright 2022-2023 Christian Mazakas.
|
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-03-19 22:24:06 +00:00
|
|
|
|
|
|
|
|
// This test creates the containers with members that meet their minimum
|
|
|
|
|
// requirements. Makes sure everything compiles and is defined correctly.
|
|
|
|
|
|
2022-10-20 15:25:40 -07:00
|
|
|
#include "../helpers/unordered.hpp"
|
2006-03-19 22:24:06 +00:00
|
|
|
|
2008-03-24 17:03:15 +00:00
|
|
|
#include "../helpers/test.hpp"
|
2006-03-19 22:24:06 +00:00
|
|
|
#include "../objects/minimal.hpp"
|
|
|
|
|
#include "./compile_tests.hpp"
|
|
|
|
|
|
2008-06-15 17:03:37 +00:00
|
|
|
// Explicit instantiation to catch compile-time errors
|
2022-10-12 13:37:12 -07:00
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
2008-06-15 17:03:37 +00:00
|
|
|
|
2022-10-12 13:37:12 -07:00
|
|
|
// emulates what was already done for previous tests but without leaking to
|
|
|
|
|
// the detail namespace
|
|
|
|
|
//
|
|
|
|
|
template <typename K, typename T, typename H, typename P, typename A>
|
|
|
|
|
class instantiate_flat_map
|
|
|
|
|
{
|
|
|
|
|
typedef boost::unordered_flat_map<K, T, H, P, A> container;
|
|
|
|
|
container x;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template class instantiate_flat_map<int, int, boost::hash<int>,
|
|
|
|
|
std::equal_to<int>, test::minimal::allocator<int> >;
|
|
|
|
|
|
|
|
|
|
template class instantiate_flat_map<test::minimal::assignable const,
|
|
|
|
|
test::minimal::default_assignable const,
|
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<int> >;
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
template <typename K, typename T, typename H, typename P, typename A>
|
|
|
|
|
class instantiate_node_map
|
|
|
|
|
{
|
|
|
|
|
typedef boost::unordered_node_map<K, T, H, P, A> container;
|
|
|
|
|
container x;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template class instantiate_node_map<int, int, boost::hash<int>,
|
|
|
|
|
std::equal_to<int>, test::minimal::allocator<int> >;
|
|
|
|
|
|
|
|
|
|
template class instantiate_node_map<test::minimal::assignable const,
|
|
|
|
|
test::minimal::default_assignable const,
|
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<int> >;
|
|
|
|
|
|
2022-10-12 13:37:12 -07:00
|
|
|
#else
|
2017-02-27 03:59:02 +00:00
|
|
|
|
2024-08-18 11:22:07 -05:00
|
|
|
template <typename K, typename M, typename H, typename P, typename A>
|
|
|
|
|
class instantiate_map
|
|
|
|
|
{
|
|
|
|
|
typedef boost::unordered_map<K, M, H, P, A> container;
|
|
|
|
|
container x;
|
|
|
|
|
typename container::node_type node_type;
|
|
|
|
|
typename container::insert_return_type insert_return_type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename K, typename M, typename H, typename P, typename A>
|
|
|
|
|
class instantiate_multimap
|
|
|
|
|
{
|
|
|
|
|
typedef boost::unordered_multimap<K, M, H, P, A> container;
|
|
|
|
|
container x;
|
|
|
|
|
typename container::node_type node_type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template class instantiate_map<int, int, boost::hash<int>, std::equal_to<int>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::allocator<int> >;
|
2024-08-18 11:22:07 -05:00
|
|
|
template class instantiate_multimap<int const, int const, boost::hash<int>,
|
2017-06-11 20:55:59 +01:00
|
|
|
std::equal_to<int>, test::minimal::allocator<int> >;
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2024-08-18 11:22:07 -05:00
|
|
|
template class instantiate_map<test::minimal::assignable const,
|
|
|
|
|
test::minimal::default_assignable const,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<int> >;
|
2024-08-18 11:22:07 -05:00
|
|
|
template class instantiate_multimap<test::minimal::assignable,
|
|
|
|
|
test::minimal::assignable, test::minimal::hash<test::minimal::assignable>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<int> >;
|
2024-08-18 11:22:07 -05:00
|
|
|
|
2022-10-12 13:37:12 -07:00
|
|
|
#endif
|
2008-06-15 17:03:37 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
template <template <class Key, class T, class H = boost::hash<Key>,
|
|
|
|
|
class P = std::equal_to<Key>,
|
|
|
|
|
class Allocator = std::allocator<std::pair<Key const, T> > >
|
|
|
|
|
class Map>
|
|
|
|
|
static void test0_impl()
|
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::constructor_param x;
|
2011-08-16 18:08:23 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
|
|
|
|
|
value_type;
|
|
|
|
|
value_type value(x, x);
|
2006-03-19 22:24:06 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int> int_map;
|
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
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int, boost::hash<int>, std::equal_to<int>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::cxx11_allocator<std::pair<int const, int> > >
|
|
|
|
|
int_map2;
|
2011-08-11 21:17:57 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<test::minimal::assignable, test::minimal::assignable,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<value_type> >
|
|
|
|
|
map;
|
2006-03-19 22:24:06 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
container_test(int_map, std::pair<int const, int>(0, 0));
|
|
|
|
|
container_test(int_map2, std::pair<int const, int>(0, 0));
|
|
|
|
|
container_test(map, value);
|
2023-02-14 09:38:08 -08:00
|
|
|
}
|
2006-03-19 22:24:06 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
UNORDERED_AUTO_TEST (test0) {
|
|
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
test0_impl<boost::unordered_flat_map>();
|
|
|
|
|
test0_impl<boost::unordered_node_map>();
|
|
|
|
|
#else
|
|
|
|
|
test0_impl<boost::unordered_map>();
|
|
|
|
|
test0_impl<boost::unordered_multimap>();
|
2022-10-12 13:37:12 -07:00
|
|
|
#endif
|
2008-01-06 17:13:15 +00:00
|
|
|
}
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
template <template <class Key, class T, class H = boost::hash<Key>,
|
|
|
|
|
class P = std::equal_to<Key>,
|
|
|
|
|
class Allocator = std::allocator<std::pair<Key const, T> > >
|
|
|
|
|
class Map>
|
|
|
|
|
static void equality_tests_impl()
|
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
typedef std::pair<test::minimal::copy_constructible_equality_comparable const,
|
|
|
|
|
test::minimal::copy_constructible_equality_comparable>
|
|
|
|
|
value_type;
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int> int_map;
|
2017-06-11 20:55:59 +01:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int, boost::hash<int>, std::equal_to<int>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::cxx11_allocator<std::pair<int const, int> > >
|
|
|
|
|
int_map2;
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<test::minimal::copy_constructible_equality_comparable,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::copy_constructible_equality_comparable,
|
|
|
|
|
test::minimal::hash<test::minimal::copy_constructible_equality_comparable>,
|
|
|
|
|
test::minimal::equal_to<
|
2017-10-05 10:54:22 +01:00
|
|
|
test::minimal::copy_constructible_equality_comparable>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::allocator<value_type> >
|
|
|
|
|
map;
|
|
|
|
|
|
|
|
|
|
equality_test(int_map);
|
|
|
|
|
equality_test(int_map2);
|
|
|
|
|
equality_test(map);
|
2023-02-14 09:38:08 -08:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
UNORDERED_AUTO_TEST (equality_tests) {
|
|
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
equality_tests_impl<boost::unordered_flat_map>();
|
|
|
|
|
equality_tests_impl<boost::unordered_node_map>();
|
|
|
|
|
#else
|
|
|
|
|
equality_tests_impl<boost::unordered_map>();
|
|
|
|
|
equality_tests_impl<boost::unordered_multimap>();
|
2022-10-12 13:37:12 -07:00
|
|
|
#endif
|
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
|
|
|
}
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
template <template <class Key, class T, class H = boost::hash<Key>,
|
|
|
|
|
class P = std::equal_to<Key>,
|
|
|
|
|
class Allocator = std::allocator<std::pair<Key const, T> > >
|
|
|
|
|
class Map>
|
|
|
|
|
static void test1_unique_impl()
|
|
|
|
|
{
|
|
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
boost::hash<int> hash;
|
|
|
|
|
std::equal_to<int> equal_to;
|
|
|
|
|
int value = 0;
|
|
|
|
|
std::pair<int const, int> map_value(0, 0);
|
2008-01-06 17:13:15 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int> map;
|
2022-10-12 13:37:12 -07:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int, boost::hash<int>, std::equal_to<int>,
|
2022-10-12 13:37:12 -07:00
|
|
|
test::minimal::cxx11_allocator<std::pair<int const, int> > >
|
|
|
|
|
map2;
|
2011-08-11 21:17:57 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
unordered_unique_test(map, map_value);
|
|
|
|
|
unordered_map_test(map, value, value);
|
|
|
|
|
unordered_copyable_test(map, value, map_value, hash, equal_to);
|
|
|
|
|
unordered_map_functions(map, value, value);
|
2008-01-06 17:13:15 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
unordered_unique_test(map2, map_value);
|
|
|
|
|
unordered_map_test(map2, value, value);
|
|
|
|
|
unordered_copyable_test(map2, value, map_value, hash, equal_to);
|
|
|
|
|
unordered_map_functions(map2, value, value);
|
2023-02-14 09:38:08 -08:00
|
|
|
}
|
2011-08-11 21:17:57 +00:00
|
|
|
|
2022-10-12 13:37:12 -07:00
|
|
|
#ifndef BOOST_UNORDERED_FOA_TESTS
|
2023-02-14 09:38:08 -08:00
|
|
|
template <template <class Key, class T, class H = boost::hash<Key>,
|
|
|
|
|
class P = std::equal_to<Key>,
|
|
|
|
|
class Allocator = std::allocator<std::pair<Key const, T> > >
|
|
|
|
|
class Map>
|
|
|
|
|
static void test1_equivalent_impl()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
boost::hash<int> hash;
|
|
|
|
|
std::equal_to<int> equal_to;
|
|
|
|
|
int value = 0;
|
|
|
|
|
std::pair<int const, int> map_value(0, 0);
|
2008-01-06 17:13:15 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int> map;
|
2008-01-06 17:13:15 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<int, int, boost::hash<int>, std::equal_to<int>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::cxx11_allocator<std::pair<int const, int> > >
|
2023-02-14 09:38:08 -08:00
|
|
|
map2;
|
2011-08-11 21:17:57 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
unordered_equivalent_test(map, map_value);
|
|
|
|
|
unordered_map_test(map, value, value);
|
|
|
|
|
unordered_copyable_test(map, value, map_value, hash, equal_to);
|
|
|
|
|
|
|
|
|
|
unordered_equivalent_test(map2, map_value);
|
|
|
|
|
unordered_map_test(map2, value, value);
|
|
|
|
|
unordered_copyable_test(map2, value, map_value, hash, equal_to);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2011-08-11 21:17:57 +00:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
UNORDERED_AUTO_TEST (test1) {
|
|
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
test1_unique_impl<boost::unordered_flat_map>();
|
|
|
|
|
test1_unique_impl<boost::unordered_node_map>();
|
|
|
|
|
#else
|
|
|
|
|
test1_unique_impl<boost::unordered_map>();
|
|
|
|
|
test1_equivalent_impl<boost::unordered_multimap>();
|
2022-10-12 13:37:12 -07:00
|
|
|
#endif
|
2008-01-06 17:13:15 +00:00
|
|
|
}
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
template <template <class Key, class T, class H = boost::hash<Key>,
|
|
|
|
|
class P = std::equal_to<Key>,
|
|
|
|
|
class Allocator = std::allocator<std::pair<Key const, T> > >
|
|
|
|
|
class Map>
|
|
|
|
|
static void test2_unique_impl()
|
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::constructor_param x;
|
|
|
|
|
|
|
|
|
|
test::minimal::assignable assignable(x);
|
|
|
|
|
test::minimal::copy_constructible copy_constructible(x);
|
|
|
|
|
test::minimal::hash<test::minimal::assignable> hash(x);
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable> equal_to(x);
|
|
|
|
|
|
|
|
|
|
typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
|
|
|
|
|
map_value_type;
|
|
|
|
|
map_value_type map_value(assignable, assignable);
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<test::minimal::assignable, test::minimal::assignable,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<map_value_type> >
|
|
|
|
|
map;
|
|
|
|
|
|
|
|
|
|
unordered_unique_test(map, map_value);
|
|
|
|
|
unordered_map_test(map, assignable, assignable);
|
|
|
|
|
unordered_copyable_test(map, assignable, map_value, hash, equal_to);
|
|
|
|
|
unordered_map_member_test(map, map_value);
|
|
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
Map<test::minimal::assignable, test::minimal::default_assignable,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<map_value_type> >
|
|
|
|
|
map2;
|
|
|
|
|
|
|
|
|
|
test::minimal::default_assignable default_assignable;
|
|
|
|
|
|
|
|
|
|
unordered_map_functions(map2, assignable, default_assignable);
|
2023-02-14 09:38:08 -08:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
|
2022-10-12 13:37:12 -07:00
|
|
|
#ifndef BOOST_UNORDERED_FOA_TESTS
|
2023-02-14 09:38:08 -08:00
|
|
|
template <template <class Key, class T, class H = boost::hash<Key>,
|
|
|
|
|
class P = std::equal_to<Key>,
|
|
|
|
|
class Allocator = std::allocator<std::pair<Key const, T> > >
|
|
|
|
|
class Map>
|
|
|
|
|
static void test2_equivalent_impl()
|
|
|
|
|
{
|
|
|
|
|
test::minimal::constructor_param x;
|
|
|
|
|
|
|
|
|
|
test::minimal::assignable assignable(x);
|
|
|
|
|
test::minimal::copy_constructible copy_constructible(x);
|
|
|
|
|
test::minimal::hash<test::minimal::assignable> hash(x);
|
|
|
|
|
test::minimal::equal_to<test::minimal::assignable> equal_to(x);
|
2017-06-11 20:55:59 +01:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
|
|
|
|
|
map_value_type;
|
|
|
|
|
map_value_type map_value(assignable, assignable);
|
|
|
|
|
|
|
|
|
|
Map<test::minimal::assignable, test::minimal::assignable,
|
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
2017-06-11 20:55:59 +01:00
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
|
test::minimal::allocator<map_value_type> >
|
2023-02-14 09:38:08 -08:00
|
|
|
map;
|
2017-06-11 20:55:59 +01:00
|
|
|
|
2023-02-14 09:38:08 -08:00
|
|
|
unordered_equivalent_test(map, map_value);
|
|
|
|
|
unordered_map_test(map, assignable, assignable);
|
|
|
|
|
unordered_copyable_test(map, assignable, map_value, hash, equal_to);
|
|
|
|
|
unordered_map_member_test(map, map_value);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
UNORDERED_AUTO_TEST (test2) {
|
|
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
test2_unique_impl<boost::unordered_flat_map>();
|
|
|
|
|
test2_unique_impl<boost::unordered_node_map>();
|
|
|
|
|
#else
|
|
|
|
|
test2_unique_impl<boost::unordered_map>();
|
|
|
|
|
test2_equivalent_impl<boost::unordered_multimap>();
|
2022-10-12 13:37:12 -07:00
|
|
|
#endif
|
2008-01-06 17:13:15 +00:00
|
|
|
}
|
|
|
|
|
|
2017-04-20 22:59:00 +01:00
|
|
|
// Test for ambiguity when using key convertible from iterator
|
|
|
|
|
// See LWG2059
|
|
|
|
|
|
|
|
|
|
struct lwg2059_key
|
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int value;
|
2017-04-20 22:59:00 +01:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <typename T> lwg2059_key(T v) : value(v) {}
|
2017-04-20 22:59:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::size_t hash_value(lwg2059_key x)
|
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return static_cast<std::size_t>(x.value);
|
2017-04-20 22:59:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; }
|
|
|
|
|
|
2017-10-09 12:34:47 +01:00
|
|
|
UNORDERED_AUTO_TEST (lwg2059) {
|
2022-10-12 13:37:12 -07:00
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
2023-02-14 09:38:08 -08:00
|
|
|
{
|
|
|
|
|
boost::unordered_flat_map<lwg2059_key, int> x;
|
|
|
|
|
x.emplace(lwg2059_key(10), 5);
|
|
|
|
|
x.erase(x.begin());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
boost::unordered_node_map<lwg2059_key, int> x;
|
|
|
|
|
x.emplace(lwg2059_key(10), 5);
|
|
|
|
|
x.erase(x.begin());
|
|
|
|
|
}
|
2022-10-12 13:37:12 -07:00
|
|
|
#else
|
2017-06-11 20:55:59 +01:00
|
|
|
{
|
|
|
|
|
boost::unordered_map<lwg2059_key, int> x;
|
|
|
|
|
x.emplace(lwg2059_key(10), 5);
|
|
|
|
|
x.erase(x.begin());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
boost::unordered_multimap<lwg2059_key, int> x;
|
|
|
|
|
x.emplace(lwg2059_key(10), 5);
|
|
|
|
|
x.erase(x.begin());
|
|
|
|
|
}
|
2022-10-12 13:37:12 -07:00
|
|
|
#endif
|
2017-04-20 22:59:00 +01:00
|
|
|
}
|
|
|
|
|
|
2008-03-24 17:03:15 +00:00
|
|
|
RUN_TESTS()
|