mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 11:27:15 +02:00
Merge branch 'develop'
This commit is contained in:
@ -276,5 +276,7 @@ C++11 support has resulted in some breaking changes:
|
|||||||
* Remove `BOOST_UNORDERED_DEPRECATED_EQUALITY` warning.
|
* Remove `BOOST_UNORDERED_DEPRECATED_EQUALITY` warning.
|
||||||
* Simpler implementation of assignment, fixes an exception safety issue
|
* Simpler implementation of assignment, fixes an exception safety issue
|
||||||
for `unordered_multiset` and `unordered_multimap`. Might be a little slower.
|
for `unordered_multiset` and `unordered_multimap`. Might be a little slower.
|
||||||
|
* Stop using return value SFINAE which some older compilers have issues
|
||||||
|
with.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
@ -484,8 +484,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// if hash function throws, or inserting > 1 element, basic exception
|
// if hash function throws, or inserting > 1 element, basic exception
|
||||||
// safety. Strong otherwise
|
// safety. Strong otherwise
|
||||||
template <class I>
|
template <class I>
|
||||||
typename boost::unordered::detail::enable_if_forward<I, void>::type
|
void insert_range(I i, I j, typename
|
||||||
insert_range(I i, I j)
|
boost::unordered::detail::enable_if_forward<I, void*>::type = 0)
|
||||||
{
|
{
|
||||||
if(i == j) return;
|
if(i == j) return;
|
||||||
|
|
||||||
@ -508,8 +508,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class I>
|
template <class I>
|
||||||
typename boost::unordered::detail::disable_if_forward<I, void>::type
|
void insert_range(I i, I j, typename
|
||||||
insert_range(I i, I j)
|
boost::unordered::detail::disable_if_forward<I, void*>::type = 0)
|
||||||
{
|
{
|
||||||
node_constructor a(this->node_alloc());
|
node_constructor a(this->node_alloc());
|
||||||
for (; i != j; ++i) {
|
for (; i != j; ++i) {
|
||||||
|
@ -125,17 +125,15 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// insert_size/initial_size
|
// insert_size/initial_size
|
||||||
|
|
||||||
template <class I>
|
template <class I>
|
||||||
inline typename
|
inline std::size_t insert_size(I i, I j, typename
|
||||||
boost::unordered::detail::enable_if_forward<I, std::size_t>::type
|
boost::unordered::detail::enable_if_forward<I, void*>::type = 0)
|
||||||
insert_size(I i, I j)
|
|
||||||
{
|
{
|
||||||
return std::distance(i, j);
|
return std::distance(i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class I>
|
template <class I>
|
||||||
inline typename
|
inline std::size_t insert_size(I, I, typename
|
||||||
boost::unordered::detail::disable_if_forward<I, std::size_t>::type
|
boost::unordered::detail::disable_if_forward<I, void*>::type = 0)
|
||||||
insert_size(I, I)
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -95,12 +95,16 @@ void erase_tests1(Container*, test::random_generator generator)
|
|||||||
BOOST_DEDUCED_TYPENAME Container::key_type
|
BOOST_DEDUCED_TYPENAME Container::key_type
|
||||||
key = test::get_key<Container>(*pos);
|
key = test::get_key<Container>(*pos);
|
||||||
std::size_t count = x.count(key);
|
std::size_t count = x.count(key);
|
||||||
|
BOOST_TEST(count > 0);
|
||||||
BOOST_TEST(next == x.erase(pos));
|
BOOST_TEST(next == x.erase(pos));
|
||||||
--size;
|
--size;
|
||||||
if(size > 0)
|
if(size > 0)
|
||||||
BOOST_TEST(index == 0 ? next == x.begin() :
|
BOOST_TEST(index == 0 ? next == x.begin() :
|
||||||
next == boost::next(prev));
|
next == boost::next(prev));
|
||||||
BOOST_TEST(x.count(key) == count - 1);
|
BOOST_TEST(x.count(key) == count - 1);
|
||||||
|
if (x.count(key) != count - 1) {
|
||||||
|
std::cerr << count << " => " << x.count(key) << std::endl;
|
||||||
|
}
|
||||||
BOOST_TEST(x.size() == size);
|
BOOST_TEST(x.size() == size);
|
||||||
if (++iterations % 20 == 0) test::check_equivalent_keys(x);
|
if (++iterations % 20 == 0) test::check_equivalent_keys(x);
|
||||||
}
|
}
|
||||||
@ -180,12 +184,16 @@ void erase_tests1(Container*, test::random_generator generator)
|
|||||||
BOOST_DEDUCED_TYPENAME Container::key_type
|
BOOST_DEDUCED_TYPENAME Container::key_type
|
||||||
key = test::get_key<Container>(*pos);
|
key = test::get_key<Container>(*pos);
|
||||||
std::size_t count = x.count(key);
|
std::size_t count = x.count(key);
|
||||||
|
BOOST_TEST(count > 0);
|
||||||
x.quick_erase(pos);
|
x.quick_erase(pos);
|
||||||
--size;
|
--size;
|
||||||
if(size > 0)
|
if(size > 0)
|
||||||
BOOST_TEST(index == 0 ? next == x.begin() :
|
BOOST_TEST(index == 0 ? next == x.begin() :
|
||||||
next == boost::next(prev));
|
next == boost::next(prev));
|
||||||
BOOST_TEST(x.count(key) == count - 1);
|
BOOST_TEST(x.count(key) == count - 1);
|
||||||
|
if (x.count(key) != count - 1) {
|
||||||
|
std::cerr << count << " => " << x.count(key) << std::endl;
|
||||||
|
}
|
||||||
BOOST_TEST(x.size() == size);
|
BOOST_TEST(x.size() == size);
|
||||||
if (++iterations % 20 == 0) test::check_equivalent_keys(x);
|
if (++iterations % 20 == 0) test::check_equivalent_keys(x);
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,10 @@ void find_tests1(X*, test::random_generator generator)
|
|||||||
iterator pos = x.find(key);
|
iterator pos = x.find(key);
|
||||||
BOOST_DEDUCED_TYPENAME X::const_iterator
|
BOOST_DEDUCED_TYPENAME X::const_iterator
|
||||||
const_pos = x_const.find(key);
|
const_pos = x_const.find(key);
|
||||||
|
BOOST_TEST(pos != x.end());
|
||||||
BOOST_TEST(pos != x.end() &&
|
BOOST_TEST(pos != x.end() &&
|
||||||
x.key_eq()(key, test::get_key<X>(*pos)));
|
x.key_eq()(key, test::get_key<X>(*pos)));
|
||||||
|
BOOST_TEST(const_pos != x_const.end());
|
||||||
BOOST_TEST(const_pos != x_const.end() &&
|
BOOST_TEST(const_pos != x_const.end() &&
|
||||||
x_const.key_eq()(key, test::get_key<X>(*const_pos)));
|
x_const.key_eq()(key, test::get_key<X>(*const_pos)));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user