mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 11:27:15 +02:00
Add compile_set tests with stub for merge()
This commit is contained in:
@ -618,10 +618,13 @@ class table_iterator
|
||||
{
|
||||
public:
|
||||
using difference_type=std::ptrdiff_t;
|
||||
using value_type=typename std::conditional<Const,const Value,Value>::type;
|
||||
using pointer=value_type*;
|
||||
using value_type=Value;
|
||||
using pointer=
|
||||
typename std::conditional<Const,value_type const*,value_type*>::type;
|
||||
using reference=value_type&;
|
||||
using iterator_category=std::forward_iterator_tag;
|
||||
using element_type=
|
||||
typename std::conditional<Const,value_type const,value_type>::type;
|
||||
|
||||
table_iterator()=default;
|
||||
template<bool Const2,typename std::enable_if<!Const2>::type* =nullptr>
|
||||
@ -746,10 +749,12 @@ struct table_arrays
|
||||
static void delete_(Allocator& al,table_arrays& arrays)noexcept
|
||||
{
|
||||
using alloc_traits=boost::allocator_traits<Allocator>;
|
||||
using pointer=typename alloc_traits::pointer;
|
||||
using pointer_traits=boost::pointer_traits<pointer>;
|
||||
|
||||
if(arrays.elements){
|
||||
alloc_traits::deallocate(
|
||||
al,arrays.elements,buffer_size(arrays.groups_size_mask+1));
|
||||
al,pointer_traits::pointer_to(*arrays.elements),buffer_size(arrays.groups_size_mask+1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -981,7 +986,7 @@ public:
|
||||
static constexpr auto pocca=
|
||||
alloc_traits::propagate_on_container_copy_assignment::value;
|
||||
|
||||
if(this!=&x){
|
||||
if(this!=std::addressof(x)){
|
||||
clear();
|
||||
h()=x.h();
|
||||
pred()=x.pred();
|
||||
@ -1025,7 +1030,7 @@ public:
|
||||
unchecked_insert(type_policy::move(*p));
|
||||
};
|
||||
|
||||
if(this!=&x){
|
||||
if(this!=std::addressof(x)){
|
||||
clear();
|
||||
h()=std::move(x.h());
|
||||
pred()=std::move(x.pred());
|
||||
|
@ -46,6 +46,7 @@ namespace boost {
|
||||
using key_type = Key;
|
||||
using value_type = typename set_types::value_type;
|
||||
using size_type = std::size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using hasher = Hash;
|
||||
using key_equal = KeyEqual;
|
||||
using allocator_type = Allocator;
|
||||
@ -68,6 +69,11 @@ namespace boost {
|
||||
{
|
||||
}
|
||||
|
||||
unordered_flat_set(size_type n, hasher const& h, allocator_type const& a)
|
||||
: unordered_flat_set(n, h, key_equal(), a)
|
||||
{
|
||||
}
|
||||
|
||||
explicit unordered_flat_set(allocator_type const& a)
|
||||
: unordered_flat_set(0, a)
|
||||
{
|
||||
@ -82,6 +88,20 @@ namespace boost {
|
||||
this->insert(first, last);
|
||||
}
|
||||
|
||||
template <class InputIt>
|
||||
unordered_flat_set(
|
||||
InputIt first, InputIt last, size_type n, allocator_type const& a)
|
||||
: unordered_flat_set(first, last, n, hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Iterator>
|
||||
unordered_flat_set(Iterator first, Iterator last, size_type n,
|
||||
hasher const& h, allocator_type const& a)
|
||||
: unordered_flat_set(first, last, n, h, key_equal(), a)
|
||||
{
|
||||
}
|
||||
|
||||
unordered_flat_set(unordered_flat_set const& other) : table_(other.table_)
|
||||
{
|
||||
}
|
||||
@ -113,6 +133,18 @@ namespace boost {
|
||||
{
|
||||
}
|
||||
|
||||
unordered_flat_set(std::initializer_list<value_type> init, size_type n,
|
||||
allocator_type const& a)
|
||||
: unordered_flat_set(init, n, hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
|
||||
unordered_flat_set(std::initializer_list<value_type> init, size_type n,
|
||||
hasher const& h, allocator_type const& a)
|
||||
: unordered_flat_set(init, n, h, key_equal(), a)
|
||||
{
|
||||
}
|
||||
|
||||
~unordered_flat_set() = default;
|
||||
|
||||
unordered_flat_set& operator=(unordered_flat_set const& other)
|
||||
@ -154,6 +186,8 @@ namespace boost {
|
||||
|
||||
size_type size() const noexcept { return table_.size(); }
|
||||
|
||||
size_type max_size() const noexcept { return table_.max_size(); }
|
||||
|
||||
/// Modifiers
|
||||
///
|
||||
|
||||
@ -229,6 +263,18 @@ namespace boost {
|
||||
table_.swap(rhs.table_);
|
||||
}
|
||||
|
||||
template <class H2, class P2>
|
||||
void merge(unordered_flat_set<key_type, H2, P2, allocator_type>& source)
|
||||
{
|
||||
(void) source;
|
||||
}
|
||||
|
||||
template <class H2, class P2>
|
||||
void merge(unordered_flat_set<key_type, H2, P2, allocator_type>&& source)
|
||||
{
|
||||
(void) source;
|
||||
}
|
||||
|
||||
/// Lookup
|
||||
///
|
||||
|
||||
|
@ -104,6 +104,7 @@ rule build_foa ( name )
|
||||
|
||||
build_foa fwd_set_test ;
|
||||
build_foa fwd_map_test ;
|
||||
build_foa compile_set ;
|
||||
build_foa constructor_tests ;
|
||||
build_foa copy_tests ;
|
||||
build_foa move_tests ;
|
||||
|
@ -8,7 +8,12 @@
|
||||
|
||||
// clang-format off
|
||||
#include "../helpers/prefix.hpp"
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
#include <boost/unordered/unordered_flat_set.hpp>
|
||||
#include <boost/unordered/detail/implementation.hpp>
|
||||
#else
|
||||
#include <boost/unordered_set.hpp>
|
||||
#endif
|
||||
#include "../helpers/postfix.hpp"
|
||||
// clang-format on
|
||||
|
||||
@ -18,6 +23,28 @@
|
||||
|
||||
// Explicit instantiation to catch compile-time errors
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
|
||||
// emulates what was already done for previous tests but without leaking to
|
||||
// the detail namespace
|
||||
//
|
||||
template <typename T, typename H, typename P, typename A>
|
||||
class instantiate_flat_set
|
||||
{
|
||||
typedef boost::unordered_flat_set<T, H, P, A> container;
|
||||
container x;
|
||||
};
|
||||
|
||||
template class instantiate_flat_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
test::minimal::allocator<int> >;
|
||||
|
||||
template class instantiate_flat_set<test::minimal::assignable const,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<int> >;
|
||||
|
||||
#else
|
||||
|
||||
#define INSTANTIATE(type) \
|
||||
template class boost::unordered::detail::instantiate_##type
|
||||
|
||||
@ -35,6 +62,8 @@ INSTANTIATE(multiset)<test::minimal::assignable,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<int> >;
|
||||
|
||||
#endif
|
||||
|
||||
UNORDERED_AUTO_TEST (test0) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
@ -42,6 +71,19 @@ UNORDERED_AUTO_TEST (test0) {
|
||||
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_set.\n";
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<int> int_set;
|
||||
|
||||
boost::unordered_flat_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
test::minimal::cxx11_allocator<int> >
|
||||
int_set2;
|
||||
|
||||
boost::unordered_flat_set<test::minimal::assignable,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<test::minimal::assignable> >
|
||||
set;
|
||||
#else
|
||||
boost::unordered_set<int> int_set;
|
||||
|
||||
boost::unordered_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
@ -53,11 +95,13 @@ UNORDERED_AUTO_TEST (test0) {
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<test::minimal::assignable> >
|
||||
set;
|
||||
#endif
|
||||
|
||||
container_test(int_set, 0);
|
||||
container_test(int_set2, 0);
|
||||
container_test(set, assignable);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multiset.\n";
|
||||
|
||||
boost::unordered_multiset<int> int_multiset;
|
||||
@ -75,11 +119,27 @@ UNORDERED_AUTO_TEST (test0) {
|
||||
container_test(int_multiset, 0);
|
||||
container_test(int_multiset2, 0);
|
||||
container_test(multiset, assignable);
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (equality_tests) {
|
||||
typedef test::minimal::copy_constructible_equality_comparable value_type;
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<int> int_set;
|
||||
|
||||
boost::unordered_flat_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
test::minimal::cxx11_allocator<int> >
|
||||
int_set2;
|
||||
|
||||
boost::unordered_flat_set<
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::hash<test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::equal_to<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
set;
|
||||
#else
|
||||
boost::unordered_set<int> int_set;
|
||||
|
||||
boost::unordered_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
@ -92,11 +152,13 @@ UNORDERED_AUTO_TEST (equality_tests) {
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
set;
|
||||
#endif
|
||||
|
||||
equality_test(int_set);
|
||||
equality_test(int_set2);
|
||||
equality_test(set);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_multiset<int> int_multiset;
|
||||
|
||||
boost::unordered_multiset<int, boost::hash<int>, std::equal_to<int>,
|
||||
@ -114,6 +176,7 @@ UNORDERED_AUTO_TEST (equality_tests) {
|
||||
equality_test(int_multiset);
|
||||
equality_test(int_multiset2);
|
||||
equality_test(multiset);
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (test1) {
|
||||
@ -122,12 +185,19 @@ UNORDERED_AUTO_TEST (test1) {
|
||||
int value = 0;
|
||||
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_set." << std::endl;
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<int> set;
|
||||
|
||||
boost::unordered_flat_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
test::minimal::cxx11_allocator<int> >
|
||||
set2;
|
||||
#else
|
||||
boost::unordered_set<int> set;
|
||||
|
||||
boost::unordered_set<int, boost::hash<int>, std::equal_to<int>,
|
||||
test::minimal::cxx11_allocator<int> >
|
||||
set2;
|
||||
#endif
|
||||
|
||||
unordered_unique_test(set, value);
|
||||
unordered_set_test(set, value);
|
||||
@ -137,6 +207,7 @@ UNORDERED_AUTO_TEST (test1) {
|
||||
unordered_set_test(set2, value);
|
||||
unordered_copyable_test(set2, value, value, hash, equal_to);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multiset." << std::endl;
|
||||
|
||||
boost::unordered_multiset<int> multiset;
|
||||
@ -152,6 +223,7 @@ UNORDERED_AUTO_TEST (test1) {
|
||||
unordered_equivalent_test(multiset2, value);
|
||||
unordered_set_test(multiset2, value);
|
||||
unordered_copyable_test(multiset2, value, value, hash, equal_to);
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (test2) {
|
||||
@ -163,18 +235,26 @@ UNORDERED_AUTO_TEST (test2) {
|
||||
test::minimal::equal_to<test::minimal::assignable> equal_to(x);
|
||||
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_set.\n";
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<test::minimal::assignable,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<test::minimal::assignable> >
|
||||
set;
|
||||
#else
|
||||
boost::unordered_set<test::minimal::assignable,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<test::minimal::assignable> >
|
||||
set;
|
||||
#endif
|
||||
|
||||
unordered_unique_test(set, assignable);
|
||||
unordered_set_test(set, assignable);
|
||||
unordered_copyable_test(set, assignable, assignable, hash, equal_to);
|
||||
unordered_set_member_test(set, assignable);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multiset.\n";
|
||||
|
||||
boost::unordered_multiset<test::minimal::assignable,
|
||||
@ -187,6 +267,7 @@ UNORDERED_AUTO_TEST (test2) {
|
||||
unordered_set_test(multiset, assignable);
|
||||
unordered_copyable_test(multiset, assignable, assignable, hash, equal_to);
|
||||
unordered_set_member_test(multiset, assignable);
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (movable1_tests) {
|
||||
@ -197,17 +278,25 @@ UNORDERED_AUTO_TEST (movable1_tests) {
|
||||
test::minimal::equal_to<test::minimal::movable1> equal_to(x);
|
||||
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_set.\n";
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<test::minimal::movable1,
|
||||
test::minimal::hash<test::minimal::movable1>,
|
||||
test::minimal::equal_to<test::minimal::movable1>,
|
||||
test::minimal::allocator<test::minimal::movable1> >
|
||||
set;
|
||||
#else
|
||||
boost::unordered_set<test::minimal::movable1,
|
||||
test::minimal::hash<test::minimal::movable1>,
|
||||
test::minimal::equal_to<test::minimal::movable1>,
|
||||
test::minimal::allocator<test::minimal::movable1> >
|
||||
set;
|
||||
#endif
|
||||
|
||||
// unordered_unique_test(set, movable1);
|
||||
unordered_set_test(set, movable1);
|
||||
unordered_movable_test(set, movable1, movable1, hash, equal_to);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multiset.\n";
|
||||
|
||||
boost::unordered_multiset<test::minimal::movable1,
|
||||
@ -219,6 +308,7 @@ UNORDERED_AUTO_TEST (movable1_tests) {
|
||||
// unordered_equivalent_test(multiset, movable1);
|
||||
unordered_set_test(multiset, movable1);
|
||||
unordered_movable_test(multiset, movable1, movable1, hash, equal_to);
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (movable2_tests) {
|
||||
@ -229,17 +319,25 @@ UNORDERED_AUTO_TEST (movable2_tests) {
|
||||
test::minimal::equal_to<test::minimal::movable2> equal_to(x);
|
||||
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_set.\n";
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<test::minimal::movable2,
|
||||
test::minimal::hash<test::minimal::movable2>,
|
||||
test::minimal::equal_to<test::minimal::movable2>,
|
||||
test::minimal::allocator<test::minimal::movable2> >
|
||||
set;
|
||||
#else
|
||||
boost::unordered_set<test::minimal::movable2,
|
||||
test::minimal::hash<test::minimal::movable2>,
|
||||
test::minimal::equal_to<test::minimal::movable2>,
|
||||
test::minimal::allocator<test::minimal::movable2> >
|
||||
set;
|
||||
#endif
|
||||
|
||||
// unordered_unique_test(set, movable2);
|
||||
unordered_set_test(set, movable2);
|
||||
unordered_movable_test(set, movable2, movable2, hash, equal_to);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multiset.\n";
|
||||
|
||||
boost::unordered_multiset<test::minimal::movable2,
|
||||
@ -251,6 +349,7 @@ UNORDERED_AUTO_TEST (movable2_tests) {
|
||||
// unordered_equivalent_test(multiset, movable2);
|
||||
unordered_set_test(multiset, movable2);
|
||||
unordered_movable_test(multiset, movable2, movable2, hash, equal_to);
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (destructible_tests) {
|
||||
@ -261,14 +360,21 @@ UNORDERED_AUTO_TEST (destructible_tests) {
|
||||
test::minimal::equal_to<test::minimal::destructible> equal_to(x);
|
||||
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_set.\n";
|
||||
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<test::minimal::destructible,
|
||||
test::minimal::hash<test::minimal::destructible>,
|
||||
test::minimal::equal_to<test::minimal::destructible> >
|
||||
set;
|
||||
#else
|
||||
boost::unordered_set<test::minimal::destructible,
|
||||
test::minimal::hash<test::minimal::destructible>,
|
||||
test::minimal::equal_to<test::minimal::destructible> >
|
||||
set;
|
||||
#endif
|
||||
|
||||
unordered_destructible_test(set);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multiset.\n";
|
||||
|
||||
boost::unordered_multiset<test::minimal::destructible,
|
||||
@ -277,6 +383,7 @@ UNORDERED_AUTO_TEST (destructible_tests) {
|
||||
multiset;
|
||||
|
||||
unordered_destructible_test(multiset);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Test for ambiguity when using key convertible from iterator
|
||||
@ -297,6 +404,11 @@ std::size_t hash_value(lwg2059_key x)
|
||||
bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; }
|
||||
|
||||
UNORDERED_AUTO_TEST (lwg2059) {
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::unordered_flat_set<lwg2059_key> x;
|
||||
x.emplace(lwg2059_key(10));
|
||||
x.erase(x.begin());
|
||||
#else
|
||||
{
|
||||
boost::unordered_set<lwg2059_key> x;
|
||||
x.emplace(lwg2059_key(10));
|
||||
@ -308,6 +420,7 @@ UNORDERED_AUTO_TEST (lwg2059) {
|
||||
x.emplace(lwg2059_key(10));
|
||||
x.erase(x.begin());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -70,7 +70,9 @@ template <class X, class T> void container_test(X& r, T const&)
|
||||
typedef typename X::reference reference;
|
||||
typedef typename X::const_reference const_reference;
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
typedef typename X::node_type node_type;
|
||||
#endif
|
||||
|
||||
typedef typename X::allocator_type allocator_type;
|
||||
|
||||
@ -97,8 +99,10 @@ template <class X, class T> void container_test(X& r, T const&)
|
||||
|
||||
// node_type
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<allocator_type, typename node_type::allocator_type>::value));
|
||||
#endif
|
||||
|
||||
// difference_type
|
||||
|
||||
@ -167,6 +171,7 @@ template <class X, class T> void container_test(X& r, T const&)
|
||||
sink(X(rvalue(a_const), m));
|
||||
X c3(rvalue(a_const), m);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
// node_type
|
||||
|
||||
implicit_construct<node_type const>();
|
||||
@ -193,6 +198,7 @@ template <class X, class T> void container_test(X& r, T const&)
|
||||
test::check_return_type<bool>::equals(n_const.empty());
|
||||
TEST_NOEXCEPT_EXPR(!n_const);
|
||||
TEST_NOEXCEPT_EXPR(n_const.empty());
|
||||
#endif
|
||||
|
||||
// Avoid unused variable warnings:
|
||||
|
||||
@ -262,24 +268,30 @@ template <class X, class Key> void unordered_set_test(X& r, Key const&)
|
||||
|
||||
typedef typename X::iterator iterator;
|
||||
typedef typename X::const_iterator const_iterator;
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
typedef typename X::local_iterator local_iterator;
|
||||
typedef typename X::const_local_iterator const_local_iterator;
|
||||
#endif
|
||||
typedef typename std::iterator_traits<iterator>::pointer iterator_pointer;
|
||||
typedef typename std::iterator_traits<const_iterator>::pointer
|
||||
const_iterator_pointer;
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
typedef typename std::iterator_traits<local_iterator>::pointer
|
||||
local_iterator_pointer;
|
||||
typedef typename std::iterator_traits<const_local_iterator>::pointer
|
||||
const_local_iterator_pointer;
|
||||
#endif
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, const_iterator_pointer>::value));
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, local_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, const_local_iterator_pointer>::value));
|
||||
#endif
|
||||
|
||||
// pointer_traits<iterator>
|
||||
|
||||
@ -299,6 +311,8 @@ template <class X, class Key> void unordered_set_test(X& r, Key const&)
|
||||
BOOST_STATIC_ASSERT((boost::is_same<std::ptrdiff_t,
|
||||
typename boost::pointer_traits<const_iterator>::difference_type>::value));
|
||||
|
||||
(void) r;
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
// pointer_traits<local_iterator>
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<local_iterator,
|
||||
@ -330,6 +344,7 @@ template <class X, class Key> void unordered_set_test(X& r, Key const&)
|
||||
r.emplace(boost::move(k_lvalue));
|
||||
node_type n1 = r.extract(r.begin());
|
||||
test::check_return_type<value_type>::equals_ref(n1.value());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class X, class Key, class T>
|
||||
@ -475,6 +490,9 @@ template <class X> void equality_test(X& r)
|
||||
|
||||
template <class X, class T> void unordered_unique_test(X& r, T const& t)
|
||||
{
|
||||
(void) r;
|
||||
(void) t;
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
typedef typename X::iterator iterator;
|
||||
test::check_return_type<std::pair<iterator, bool> >::equals(r.insert(t));
|
||||
test::check_return_type<std::pair<iterator, bool> >::equals(r.emplace(t));
|
||||
@ -503,6 +521,7 @@ template <class X, class T> void unordered_unique_test(X& r, T const& t)
|
||||
test::check_return_type<iterator>::equals(insert_return.position);
|
||||
test::check_return_type<node_type>::equals_ref(insert_return.node);
|
||||
boost::swap(insert_return, insert_return2);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class X, class T> void unordered_equivalent_test(X& r, T const& t)
|
||||
@ -554,6 +573,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
|
||||
typedef typename X::iterator iterator;
|
||||
typedef typename X::const_iterator const_iterator;
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
typedef typename X::local_iterator local_iterator;
|
||||
typedef typename X::const_local_iterator const_local_iterator;
|
||||
|
||||
@ -590,6 +610,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
const_local_iterator_pointer;
|
||||
typedef typename std::iterator_traits<const_local_iterator>::reference
|
||||
const_local_iterator_reference;
|
||||
#endif
|
||||
typedef typename X::allocator_type allocator_type;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Key, key_type>::value));
|
||||
@ -602,6 +623,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Pred, key_equal>::value));
|
||||
test::check_return_type<bool>::convertible(eq(k, k));
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
boost::function_requires<boost::InputIteratorConcept<local_iterator> >();
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<local_iterator_category, iterator_category>::value));
|
||||
@ -622,6 +644,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
const_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<const_local_iterator_reference,
|
||||
const_iterator_reference>::value));
|
||||
#endif
|
||||
|
||||
X a;
|
||||
allocator_type m = a.get_allocator();
|
||||
@ -667,6 +690,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
test::check_return_type<std::pair<const_iterator, const_iterator> >::equals(
|
||||
b.equal_range(k));
|
||||
test::check_return_type<size_type>::equals(b.bucket_count());
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
test::check_return_type<size_type>::equals(b.max_bucket_count());
|
||||
test::check_return_type<size_type>::equals(b.bucket(k));
|
||||
test::check_return_type<size_type>::equals(b.bucket_size(0));
|
||||
@ -680,6 +704,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
test::check_return_type<const_local_iterator>::equals(b.cbegin(0));
|
||||
test::check_return_type<const_local_iterator>::equals(a.cend(0));
|
||||
test::check_return_type<const_local_iterator>::equals(b.cend(0));
|
||||
#endif
|
||||
|
||||
test::check_return_type<float>::equals(b.load_factor());
|
||||
test::check_return_type<float>::equals(b.max_load_factor());
|
||||
@ -792,7 +817,11 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
|
||||
X a10;
|
||||
a10.insert(t);
|
||||
q = a10.cbegin();
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_STATIC_ASSERT(std::is_same<void, decltype(a10.erase(q))>::value);
|
||||
#else
|
||||
test::check_return_type<iterator>::equals(a10.erase(q));
|
||||
#endif
|
||||
|
||||
// Avoid unused variable warnings:
|
||||
|
||||
@ -807,10 +836,12 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
|
||||
sink(a7a);
|
||||
sink(a9a);
|
||||
|
||||
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||
typedef typename X::node_type node_type;
|
||||
typedef typename X::allocator_type allocator_type;
|
||||
node_type const n_const = a.extract(a.begin());
|
||||
test::check_return_type<allocator_type>::equals(n_const.get_allocator());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class X, class Key, class T, class Hash, class Pred>
|
||||
@ -879,7 +910,11 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
|
||||
T v5(v);
|
||||
a10.insert(boost::move(v5));
|
||||
q = a10.cbegin();
|
||||
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||
BOOST_STATIC_ASSERT(std::is_same<void, decltype(a10.erase(q))>::value);
|
||||
#else
|
||||
test::check_return_type<iterator>::equals(a10.erase(q));
|
||||
#endif
|
||||
|
||||
// Avoid unused variable warnings:
|
||||
|
||||
|
Reference in New Issue
Block a user