Remove BOOST_NOEXCEPT

This commit is contained in:
Christian Mazakas
2023-08-28 12:24:25 -07:00
parent 6b65c8f230
commit aa16d1b8a9
10 changed files with 427 additions and 499 deletions

View File

@ -147,14 +147,14 @@ namespace boost {
typename boost::aligned_storage<sizeof(value_type), typename boost::aligned_storage<sizeof(value_type),
boost::alignment_of<value_type>::value>::type buf; boost::alignment_of<value_type>::value>::type buf;
node() BOOST_NOEXCEPT : next(), buf() {} node() noexcept : next(), buf() {}
value_type* value_ptr() BOOST_NOEXCEPT value_type* value_ptr() noexcept
{ {
return reinterpret_cast<value_type*>(buf.address()); return reinterpret_cast<value_type*>(buf.address());
} }
value_type& value() BOOST_NOEXCEPT value_type& value() noexcept
{ {
return *reinterpret_cast<value_type*>(buf.address()); return *reinterpret_cast<value_type*>(buf.address());
} }
@ -170,7 +170,7 @@ namespace boost {
node_pointer next; node_pointer next;
bucket() BOOST_NOEXCEPT : next() {} bucket() noexcept : next() {}
}; };
template <class Bucket> struct bucket_group template <class Bucket> struct bucket_group
@ -186,7 +186,7 @@ namespace boost {
std::size_t bitmask; std::size_t bitmask;
bucket_group_pointer next, prev; bucket_group_pointer next, prev;
bucket_group() BOOST_NOEXCEPT : buckets(), bitmask(0), next(), prev() {} bucket_group() noexcept : buckets(), bitmask(0), next(), prev() {}
~bucket_group() {} ~bucket_group() {}
}; };
@ -224,33 +224,28 @@ namespace boost {
public: public:
grouped_bucket_iterator() : p(), pbg() {} grouped_bucket_iterator() : p(), pbg() {}
reference operator*() const BOOST_NOEXCEPT { return dereference(); } reference operator*() const noexcept { return dereference(); }
pointer operator->() const BOOST_NOEXCEPT pointer operator->() const noexcept { return boost::to_address(p); }
{
return boost::to_address(p);
}
grouped_bucket_iterator& operator++() BOOST_NOEXCEPT grouped_bucket_iterator& operator++() noexcept
{ {
increment(); increment();
return *this; return *this;
} }
grouped_bucket_iterator operator++(int) BOOST_NOEXCEPT grouped_bucket_iterator operator++(int) noexcept
{ {
grouped_bucket_iterator old = *this; grouped_bucket_iterator old = *this;
increment(); increment();
return old; return old;
} }
bool operator==( bool operator==(grouped_bucket_iterator const& other) const noexcept
grouped_bucket_iterator const& other) const BOOST_NOEXCEPT
{ {
return equal(other); return equal(other);
} }
bool operator!=( bool operator!=(grouped_bucket_iterator const& other) const noexcept
grouped_bucket_iterator const& other) const BOOST_NOEXCEPT
{ {
return !equal(other); return !equal(other);
} }
@ -266,14 +261,14 @@ namespace boost {
{ {
} }
Bucket& dereference() const BOOST_NOEXCEPT { return *p; } Bucket& dereference() const noexcept { return *p; }
bool equal(const grouped_bucket_iterator& x) const BOOST_NOEXCEPT bool equal(const grouped_bucket_iterator& x) const noexcept
{ {
return p == x.p; return p == x.p;
} }
void increment() BOOST_NOEXCEPT void increment() noexcept
{ {
std::size_t const offset = static_cast<std::size_t>(p - pbg->buckets); std::size_t const offset = static_cast<std::size_t>(p - pbg->buckets);
@ -290,7 +285,7 @@ namespace boost {
} }
} }
template<typename Archive> template <typename Archive>
friend void serialization_track( friend void serialization_track(
Archive& ar, grouped_bucket_iterator const& x) Archive& ar, grouped_bucket_iterator const& x)
{ {
@ -301,8 +296,7 @@ namespace boost {
friend class boost::serialization::access; friend class boost::serialization::access;
template<typename Archive> template <typename Archive> void serialize(Archive& ar, unsigned int)
void serialize(Archive& ar,unsigned int)
{ {
// requires: not at end() position // requires: not at end() position
serialize_tracked_address(ar, p); serialize_tracked_address(ar, p);
@ -326,20 +320,17 @@ namespace boost {
grouped_local_bucket_iterator() : p() {} grouped_local_bucket_iterator() : p() {}
reference operator*() const BOOST_NOEXCEPT { return dereference(); } reference operator*() const noexcept { return dereference(); }
pointer operator->() const BOOST_NOEXCEPT pointer operator->() const noexcept { return boost::to_address(p); }
{
return boost::to_address(p);
}
grouped_local_bucket_iterator& operator++() BOOST_NOEXCEPT grouped_local_bucket_iterator& operator++() noexcept
{ {
increment(); increment();
return *this; return *this;
} }
grouped_local_bucket_iterator operator++(int) BOOST_NOEXCEPT grouped_local_bucket_iterator operator++(int) noexcept
{ {
grouped_local_bucket_iterator old = *this; grouped_local_bucket_iterator old = *this;
increment(); increment();
@ -347,13 +338,13 @@ namespace boost {
} }
bool operator==( bool operator==(
grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT grouped_local_bucket_iterator const& other) const noexcept
{ {
return equal(other); return equal(other);
} }
bool operator!=( bool operator!=(
grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT grouped_local_bucket_iterator const& other) const noexcept
{ {
return !equal(other); return !equal(other);
} }
@ -366,14 +357,14 @@ namespace boost {
grouped_local_bucket_iterator(node_pointer p_) : p(p_) {} grouped_local_bucket_iterator(node_pointer p_) : p(p_) {}
value_type& dereference() const BOOST_NOEXCEPT { return p->value(); } value_type& dereference() const noexcept { return p->value(); }
bool equal(const grouped_local_bucket_iterator& x) const BOOST_NOEXCEPT bool equal(const grouped_local_bucket_iterator& x) const noexcept
{ {
return p == x.p; return p == x.p;
} }
void increment() BOOST_NOEXCEPT { p = p->next; } void increment() noexcept { p = p->next; }
node_pointer p; node_pointer p;
}; };
@ -397,20 +388,17 @@ namespace boost {
{ {
} }
reference operator*() const BOOST_NOEXCEPT { return dereference(); } reference operator*() const noexcept { return dereference(); }
pointer operator->() const BOOST_NOEXCEPT pointer operator->() const noexcept { return boost::to_address(p); }
{
return boost::to_address(p);
}
const_grouped_local_bucket_iterator& operator++() BOOST_NOEXCEPT const_grouped_local_bucket_iterator& operator++() noexcept
{ {
increment(); increment();
return *this; return *this;
} }
const_grouped_local_bucket_iterator operator++(int) BOOST_NOEXCEPT const_grouped_local_bucket_iterator operator++(int) noexcept
{ {
const_grouped_local_bucket_iterator old = *this; const_grouped_local_bucket_iterator old = *this;
increment(); increment();
@ -418,13 +406,13 @@ namespace boost {
} }
bool operator==( bool operator==(
const_grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT const_grouped_local_bucket_iterator const& other) const noexcept
{ {
return equal(other); return equal(other);
} }
bool operator!=( bool operator!=(
const_grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT const_grouped_local_bucket_iterator const& other) const noexcept
{ {
return !equal(other); return !equal(other);
} }
@ -435,23 +423,22 @@ namespace boost {
const_grouped_local_bucket_iterator(node_pointer p_) : p(p_) {} const_grouped_local_bucket_iterator(node_pointer p_) : p(p_) {}
value_type& dereference() const BOOST_NOEXCEPT { return p->value(); } value_type& dereference() const noexcept { return p->value(); }
bool equal( bool equal(const const_grouped_local_bucket_iterator& x) const noexcept
const const_grouped_local_bucket_iterator& x) const BOOST_NOEXCEPT
{ {
return p == x.p; return p == x.p;
} }
void increment() BOOST_NOEXCEPT { p = p->next; } void increment() noexcept { p = p->next; }
node_pointer p; node_pointer p;
}; };
template <class T> struct span template <class T> struct span
{ {
T* begin() const BOOST_NOEXCEPT { return data; } T* begin() const noexcept { return data; }
T* end() const BOOST_NOEXCEPT { return data + size; } T* end() const noexcept { return data + size; }
T* data; T* data;
std::size_t size; std::size_t size;
@ -532,8 +519,7 @@ namespace boost {
grouped_bucket_array(size_type n, const Allocator& al) grouped_bucket_array(size_type n, const Allocator& al)
: empty_value<node_allocator_type>(empty_init_t(), al), : empty_value<node_allocator_type>(empty_init_t(), al),
size_index_(0), size_index_(0), size_(0), buckets(), groups()
size_(0), buckets(), groups()
{ {
if (n == 0) { if (n == 0) {
return; return;
@ -582,8 +568,7 @@ namespace boost {
~grouped_bucket_array() { this->deallocate(); } ~grouped_bucket_array() { this->deallocate(); }
grouped_bucket_array( grouped_bucket_array(BOOST_RV_REF(grouped_bucket_array) other) noexcept
BOOST_RV_REF(grouped_bucket_array) other) BOOST_NOEXCEPT
: empty_value<node_allocator_type>( : empty_value<node_allocator_type>(
empty_init_t(), other.get_node_allocator()), empty_init_t(), other.get_node_allocator()),
size_index_(other.size_index_), size_index_(other.size_index_),
@ -598,7 +583,7 @@ namespace boost {
} }
grouped_bucket_array& operator=( grouped_bucket_array& operator=(
BOOST_RV_REF(grouped_bucket_array) other) BOOST_NOEXCEPT BOOST_RV_REF(grouped_bucket_array) other) noexcept
{ {
BOOST_ASSERT( BOOST_ASSERT(
this->get_node_allocator() == other.get_node_allocator()); this->get_node_allocator() == other.get_node_allocator());
@ -622,7 +607,7 @@ namespace boost {
return *this; return *this;
} }
void deallocate() BOOST_NOEXCEPT void deallocate() noexcept
{ {
if (buckets) { if (buckets) {
bucket_allocator_type bucket_alloc = this->get_bucket_allocator(); bucket_allocator_type bucket_alloc = this->get_bucket_allocator();
@ -651,7 +636,8 @@ namespace boost {
bool b = boost::allocator_propagate_on_container_swap< bool b = boost::allocator_propagate_on_container_swap<
allocator_type>::type::value; allocator_type>::type::value;
if (b) { if (b) {
boost::core::invoke_swap(get_node_allocator(), other.get_node_allocator()); boost::core::invoke_swap(
get_node_allocator(), other.get_node_allocator());
} }
} }
@ -675,12 +661,9 @@ namespace boost {
return this->get_node_allocator(); return this->get_node_allocator();
} }
size_type buckets_len() const BOOST_NOEXCEPT { return size_ + 1; } size_type buckets_len() const noexcept { return size_ + 1; }
size_type groups_len() const BOOST_NOEXCEPT size_type groups_len() const noexcept { return size_ / group::N + 1; }
{
return size_ / group::N + 1;
}
void reset_allocator(Allocator const& allocator_) void reset_allocator(Allocator const& allocator_)
{ {
@ -713,7 +696,7 @@ namespace boost {
local_iterator end(size_type) const { return local_iterator(); } local_iterator end(size_type) const { return local_iterator(); }
size_type capacity() const BOOST_NOEXCEPT { return size_; } size_type capacity() const noexcept { return size_; }
iterator at(size_type n) const iterator at(size_type n) const
{ {
@ -747,7 +730,7 @@ namespace boost {
size_ = 0; size_ = 0;
} }
void append_bucket_group(iterator itb) BOOST_NOEXCEPT void append_bucket_group(iterator itb) noexcept
{ {
std::size_t const N = group::N; std::size_t const N = group::N;
@ -777,7 +760,7 @@ namespace boost {
} }
} }
void insert_node(iterator itb, node_pointer p) BOOST_NOEXCEPT void insert_node(iterator itb, node_pointer p) noexcept
{ {
this->append_bucket_group(itb); this->append_bucket_group(itb);
@ -786,7 +769,7 @@ namespace boost {
} }
void insert_node_hint( void insert_node_hint(
iterator itb, node_pointer p, node_pointer hint) BOOST_NOEXCEPT iterator itb, node_pointer p, node_pointer hint) noexcept
{ {
this->append_bucket_group(itb); this->append_bucket_group(itb);
@ -799,7 +782,7 @@ namespace boost {
} }
} }
void extract_node(iterator itb, node_pointer p) BOOST_NOEXCEPT void extract_node(iterator itb, node_pointer p) noexcept
{ {
node_pointer* pp = boost::addressof(itb->next); node_pointer* pp = boost::addressof(itb->next);
while ((*pp) != p) while ((*pp) != p)
@ -809,14 +792,14 @@ namespace boost {
unlink_bucket(itb); unlink_bucket(itb);
} }
void extract_node_after(iterator itb, node_pointer* pp) BOOST_NOEXCEPT void extract_node_after(iterator itb, node_pointer* pp) noexcept
{ {
*pp = (*pp)->next; *pp = (*pp)->next;
if (!itb->next) if (!itb->next)
unlink_bucket(itb); unlink_bucket(itb);
} }
void unlink_empty_buckets() BOOST_NOEXCEPT void unlink_empty_buckets() noexcept
{ {
std::size_t const N = group::N; std::size_t const N = group::N;
@ -864,7 +847,7 @@ namespace boost {
} }
}; };
} // namespace detail } // namespace detail
} // namespace unordered } // namespace unordered
} // namespace boost } // namespace boost
#endif // BOOST_UNORDERED_DETAIL_FCA_HPP #endif // BOOST_UNORDERED_DETAIL_FCA_HPP

View File

@ -1,7 +1,7 @@
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
// Copyright (C) 2005-2016 Daniel James // Copyright (C) 2005-2016 Daniel James
// Copyright (C) 2022-2023 Joaquin M Lopez Munoz. // Copyright (C) 2022-2023 Joaquin M Lopez Munoz.
// Copyright (C) 2022 Christian Mazakas // Copyright (C) 2022-2023 Christian Mazakas
// //
// Distributed under the Boost Software License, Version 1.0. (See accompanying // 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) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -14,6 +14,11 @@
#pragma once #pragma once
#endif #endif
#include <boost/unordered/detail/fca.hpp>
#include <boost/unordered/detail/fwd.hpp>
#include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/allocator_traits.hpp> #include <boost/core/allocator_traits.hpp>
#include <boost/core/bit.hpp> #include <boost/core/bit.hpp>
@ -47,12 +52,9 @@
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/make_void.hpp> #include <boost/type_traits/make_void.hpp>
#include <boost/type_traits/remove_const.hpp> #include <boost/type_traits/remove_const.hpp>
#include <boost/unordered/detail/fca.hpp>
#include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/unordered/detail/fwd.hpp>
#include <boost/utility/addressof.hpp> #include <boost/utility/addressof.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <cmath> #include <cmath>
#include <iterator> #include <iterator>
#include <stdexcept> #include <stdexcept>
@ -63,8 +65,8 @@
#endif #endif
#if BOOST_UNORDERED_CXX11_CONSTRUCTION #if BOOST_UNORDERED_CXX11_CONSTRUCTION
#include <boost/mp11/list.hpp>
#include <boost/mp11/algorithm.hpp> #include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.hpp>
#endif #endif
// BOOST_UNORDERED_SUPPRESS_DEPRECATED // BOOST_UNORDERED_SUPPRESS_DEPRECATED
@ -125,7 +127,7 @@ namespace boost {
template <class T> inline void ignore_unused_variable_warning(T const&) template <class T> inline void ignore_unused_variable_warning(T const&)
{ {
} }
} } // namespace func
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// iterator SFINAE // iterator SFINAE
@ -138,20 +140,20 @@ namespace boost {
template <typename I, typename ReturnType> template <typename I, typename ReturnType>
struct enable_if_forward struct enable_if_forward
: boost::enable_if_c<boost::unordered::detail::is_forward<I>::value, : boost::enable_if_c<boost::unordered::detail::is_forward<I>::value,
ReturnType> ReturnType>
{ {
}; };
template <typename I, typename ReturnType> template <typename I, typename ReturnType>
struct disable_if_forward struct disable_if_forward
: boost::disable_if_c<boost::unordered::detail::is_forward<I>::value, : boost::disable_if_c<boost::unordered::detail::is_forward<I>::value,
ReturnType> ReturnType>
{ {
}; };
} } // namespace detail
} } // namespace unordered
} } // namespace boost
namespace boost { namespace boost {
namespace unordered { namespace unordered {
@ -169,7 +171,8 @@ namespace boost {
template <class I> template <class I>
inline typename boost::unordered::detail::disable_if_forward<I, inline typename boost::unordered::detail::disable_if_forward<I,
std::size_t>::type insert_size(I, I) std::size_t>::type
insert_size(I, I)
{ {
return 1; return 1;
} }
@ -211,8 +214,8 @@ namespace boost {
template <typename T1, typename T2> template <typename T1, typename T2>
struct compressed struct compressed
: private boost::unordered::detail::generate_base<T1, 1>::type, : private boost::unordered::detail::generate_base<T1, 1>::type,
private boost::unordered::detail::generate_base<T2, 2>::type private boost::unordered::detail::generate_base<T2, 2>::type
{ {
typedef typename generate_base<T1, 1>::type base1; typedef typename generate_base<T1, 1>::type base1;
typedef typename generate_base<T2, 2>::type base2; typedef typename generate_base<T2, 2>::type base2;
@ -353,9 +356,9 @@ namespace boost {
{ {
template <typename T> convert_from_anything(T const&); template <typename T> convert_from_anything(T const&);
}; };
} } // namespace detail
} } // namespace unordered
} } // namespace boost
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// emplace_args // emplace_args
@ -412,7 +415,7 @@ namespace boost {
\ \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
inline BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> \ inline BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> \
create_emplace_args(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \ create_emplace_args(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \
{ \ { \
BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> e( \ BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> e( \
BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \ BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \
@ -477,9 +480,9 @@ namespace boost {
BOOST_UNORDERED_EARGS(1, 9, _) BOOST_UNORDERED_EARGS(1, 9, _)
BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
BOOST_UNORDERED_EARGS, _) BOOST_UNORDERED_EARGS, _)
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS #undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS
#undef BOOST_UNORDERED_EARGS_MEMBER #undef BOOST_UNORDERED_EARGS_MEMBER
@ -496,16 +499,16 @@ namespace boost {
namespace unordered { namespace unordered {
namespace detail { namespace detail {
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Integral_constrant, true_type, false_type // Integral_constrant, true_type, false_type
// //
// Uses the standard versions if available. // Uses the standard versions if available.
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
using std::false_type;
using std::integral_constant; using std::integral_constant;
using std::true_type; using std::true_type;
using std::false_type;
#else #else
@ -523,8 +526,8 @@ namespace boost {
#endif #endif
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Explicitly call a destructor // Explicitly call a destructor
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
#pragma warning(push) #pragma warning(push)
@ -533,7 +536,7 @@ namespace boost {
namespace func { namespace func {
template <class T> inline void destroy(T* x) { x->~T(); } template <class T> inline void destroy(T* x) { x->~T(); }
} } // namespace func
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
#pragma warning(pop) #pragma warning(pop)
@ -596,7 +599,7 @@ namespace boost {
} }
public: public:
optional() BOOST_NOEXCEPT : has_value_(false) {} optional() noexcept : has_value_(false) {}
optional(BOOST_RV_REF(optional<T>) x) : has_value_(false) optional(BOOST_RV_REF(optional<T>) x) : has_value_(false)
{ {
@ -650,9 +653,9 @@ namespace boost {
friend void swap(optional<T>& x, optional<T>& y) { x.swap(y); } friend void swap(optional<T>& x, optional<T>& y) { x.swap(y); }
}; };
} } // namespace detail
} } // namespace unordered
} } // namespace boost
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
@ -672,9 +675,9 @@ namespace boost {
struct rebind_wrap : boost::allocator_rebind<Alloc, T> struct rebind_wrap : boost::allocator_rebind<Alloc, T>
{ {
}; };
} } // namespace detail
} } // namespace unordered
} } // namespace boost
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Functions used to construct nodes. Emulates variadic construction, // Functions used to construct nodes. Emulates variadic construction,
@ -699,10 +702,10 @@ namespace boost {
{ {
new ((void*)address) T(boost::forward<Args>(args)...); new ((void*)address) T(boost::forward<Args>(args)...);
} }
} } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#else #else
@ -720,10 +723,10 @@ namespace boost {
{ {
new ((void*)address) T(boost::forward<A0>(a0)); new ((void*)address) T(boost::forward<A0>(a0));
} }
} } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#endif #endif
@ -769,10 +772,10 @@ namespace boost {
BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 8, boost) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 8, boost)
BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 9, boost) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 9, boost)
BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 10, boost) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 10, boost)
} } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#endif #endif
@ -800,10 +803,10 @@ namespace boost {
BOOST_PP_REPEAT_FROM_TO(6, BOOST_PP_INC(BOOST_UNORDERED_TUPLE_ARGS), BOOST_PP_REPEAT_FROM_TO(6, BOOST_PP_INC(BOOST_UNORDERED_TUPLE_ARGS),
BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE, std) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE, std)
#endif #endif
} } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#endif #endif
@ -866,10 +869,10 @@ namespace boost {
boost::tuples::length<Tuple>::value>(), boost::tuples::length<Tuple>::value>(),
alloc, ptr, x); alloc, ptr, x);
} }
} } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE #undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE
#undef BOOST_UNORDERED_GET_TUPLE_ARG #undef BOOST_UNORDERED_GET_TUPLE_ARG
@ -937,7 +940,7 @@ namespace boost {
to_std_tuple_impl(boost::mp11::mp_list<Args...>, to_std_tuple_impl(boost::mp11::mp_list<Args...>,
boost::tuple<TupleArgs...>& tuple, boost::mp11::index_sequence<Is...>) boost::tuple<TupleArgs...>& tuple, boost::mp11::index_sequence<Is...>)
{ {
(void) tuple; (void)tuple;
return std::tuple<typename std::add_lvalue_reference<Args>::type...>( return std::tuple<typename std::add_lvalue_reference<Args>::type...>(
boost::get<Is>(tuple)...); boost::get<Is>(tuple)...);
} }
@ -1041,7 +1044,7 @@ namespace boost {
boost::forward<A1>(args.a1), boost::forward<A2>(args.a2)); boost::forward<A1>(args.a1), boost::forward<A2>(args.a2));
} }
// Use a macro for the rest. // Use a macro for the rest.
#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ #define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \
template <typename Alloc, typename T, \ template <typename Alloc, typename T, \
@ -1090,10 +1093,10 @@ namespace boost {
} }
#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
} } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
namespace boost { namespace boost {
namespace unordered { namespace unordered {
@ -1182,9 +1185,9 @@ namespace boost {
boost::allocator_deallocate(alloc_, node_, 1); boost::allocator_deallocate(alloc_, node_, 1);
} }
} }
} } // namespace detail
} } // namespace unordered
} } // namespace boost
namespace boost { namespace boost {
namespace unordered { namespace unordered {
@ -1247,8 +1250,8 @@ namespace boost {
value_allocator val_alloc(alloc); value_allocator val_alloc(alloc);
boost::allocator_construct( boost::allocator_construct(val_alloc, a.node_->value_ptr(),
val_alloc, a.node_->value_ptr(), std::piecewise_construct, std::piecewise_construct,
std::forward_as_tuple(boost::forward<Key>(k)), std::forward_as_tuple(boost::forward<Key>(k)),
std::forward_as_tuple()); std::forward_as_tuple());
return a.release(); return a.release();
@ -1409,9 +1412,9 @@ namespace boost {
return construct_node_pair(alloc, boost::forward<Key>(k)); return construct_node_pair(alloc, boost::forward<Key>(k));
} }
} // namespace func } // namespace func
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#if defined(BOOST_MSVC) #if defined(BOOST_MSVC)
#pragma warning(pop) #pragma warning(pop)
@ -1437,12 +1440,12 @@ namespace boost {
// in that region of storage. This warning is also generated in C++03 // in that region of storage. This warning is also generated in C++03
// which does not have `std::launder`. The compiler builtin is always // which does not have `std::launder`. The compiler builtin is always
// available, regardless of the C++ standard used when compiling. // available, regardless of the C++ standard used when compiling.
template <class T> T* launder(T* p) BOOST_NOEXCEPT template <class T> T* launder(T* p) noexcept
{ {
return __builtin_launder(p); return __builtin_launder(p);
} }
#else #else
template <class T> T* launder(T* p) BOOST_NOEXCEPT { return p; } template <class T> T* launder(T* p) noexcept { return p; }
#endif #endif
template <class H, class P> class functions template <class H, class P> class functions
@ -1566,9 +1569,9 @@ namespace boost {
} }
}; };
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// rvalue parameters when type can't be a BOOST_RV_REF(T) parameter // rvalue parameters when type can't be a BOOST_RV_REF(T) parameter
// e.g. for int // e.g. for int
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T) #define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T)
@ -1626,48 +1629,48 @@ namespace boost {
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
iterator() : p(), itb(){} iterator() : p(), itb() {}
reference operator*() const BOOST_NOEXCEPT { return dereference(); } reference operator*() const noexcept { return dereference(); }
pointer operator->() const BOOST_NOEXCEPT pointer operator->() const noexcept
{ {
pointer x = boost::addressof(p->value()); pointer x = boost::addressof(p->value());
return x; return x;
} }
iterator& operator++() BOOST_NOEXCEPT iterator& operator++() noexcept
{ {
increment(); increment();
return *this; return *this;
} }
iterator operator++(int) BOOST_NOEXCEPT iterator operator++(int) noexcept
{ {
iterator old = *this; iterator old = *this;
increment(); increment();
return old; return old;
} }
bool operator==(iterator const& other) const BOOST_NOEXCEPT bool operator==(iterator const& other) const noexcept
{ {
return equal(other); return equal(other);
} }
bool operator!=(iterator const& other) const BOOST_NOEXCEPT bool operator!=(iterator const& other) const noexcept
{ {
return !equal(other); return !equal(other);
} }
bool operator==( bool operator==(
boost::unordered::detail::iterator_detail::c_iterator<Node, boost::unordered::detail::iterator_detail::c_iterator<Node,
Bucket> const& other) const BOOST_NOEXCEPT Bucket> const& other) const noexcept
{ {
return equal(other); return equal(other);
} }
bool operator!=( bool operator!=(
boost::unordered::detail::iterator_detail::c_iterator<Node, boost::unordered::detail::iterator_detail::c_iterator<Node,
Bucket> const& other) const BOOST_NOEXCEPT Bucket> const& other) const noexcept
{ {
return !equal(other); return !equal(other);
} }
@ -1684,21 +1687,18 @@ namespace boost {
iterator(node_pointer p_, bucket_iterator itb_) : p(p_), itb(itb_) {} iterator(node_pointer p_, bucket_iterator itb_) : p(p_), itb(itb_) {}
value_type& dereference() const BOOST_NOEXCEPT { return p->value(); } value_type& dereference() const noexcept { return p->value(); }
bool equal(const iterator& x) const BOOST_NOEXCEPT bool equal(const iterator& x) const noexcept { return (p == x.p); }
{
return (p == x.p);
}
bool equal( bool equal(
const boost::unordered::detail::iterator_detail::c_iterator<Node, const boost::unordered::detail::iterator_detail::c_iterator<Node,
Bucket>& x) const BOOST_NOEXCEPT Bucket>& x) const noexcept
{ {
return (p == x.p); return (p == x.p);
} }
void increment() BOOST_NOEXCEPT void increment() noexcept
{ {
p = p->next; p = p->next;
if (!p) { if (!p) {
@ -1706,10 +1706,10 @@ namespace boost {
} }
} }
template<typename Archive> template <typename Archive>
friend void serialization_track(Archive& ar, const iterator& x) friend void serialization_track(Archive& ar, const iterator& x)
{ {
if(x.p){ if (x.p) {
track_address(ar, x.p); track_address(ar, x.p);
serialization_track(ar, x.itb); serialization_track(ar, x.itb);
} }
@ -1717,12 +1717,12 @@ namespace boost {
friend class boost::serialization::access; friend class boost::serialization::access;
template<typename Archive> template <typename Archive> void serialize(Archive& ar, unsigned int)
void serialize(Archive& ar,unsigned int)
{ {
if(!p) itb = bucket_iterator(); if (!p)
itb = bucket_iterator();
serialize_tracked_address(ar, p); serialize_tracked_address(ar, p);
ar & core::make_nvp("bucket_iterator", itb); ar& core::make_nvp("bucket_iterator", itb);
} }
}; };
@ -1736,49 +1736,49 @@ namespace boost {
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
c_iterator() : p(), itb(){} c_iterator() : p(), itb() {}
c_iterator(iterator<Node, Bucket> it) : p(it.p), itb(it.itb) {} c_iterator(iterator<Node, Bucket> it) : p(it.p), itb(it.itb) {}
reference operator*() const BOOST_NOEXCEPT { return dereference(); } reference operator*() const noexcept { return dereference(); }
pointer operator->() const BOOST_NOEXCEPT pointer operator->() const noexcept
{ {
pointer x = boost::addressof(p->value()); pointer x = boost::addressof(p->value());
return x; return x;
} }
c_iterator& operator++() BOOST_NOEXCEPT c_iterator& operator++() noexcept
{ {
increment(); increment();
return *this; return *this;
} }
c_iterator operator++(int) BOOST_NOEXCEPT c_iterator operator++(int) noexcept
{ {
c_iterator old = *this; c_iterator old = *this;
increment(); increment();
return old; return old;
} }
bool operator==(c_iterator const& other) const BOOST_NOEXCEPT bool operator==(c_iterator const& other) const noexcept
{ {
return equal(other); return equal(other);
} }
bool operator!=(c_iterator const& other) const BOOST_NOEXCEPT bool operator!=(c_iterator const& other) const noexcept
{ {
return !equal(other); return !equal(other);
} }
bool operator==( bool operator==(
boost::unordered::detail::iterator_detail::iterator<Node, boost::unordered::detail::iterator_detail::iterator<Node,
Bucket> const& other) const BOOST_NOEXCEPT Bucket> const& other) const noexcept
{ {
return equal(other); return equal(other);
} }
bool operator!=( bool operator!=(
boost::unordered::detail::iterator_detail::iterator<Node, boost::unordered::detail::iterator_detail::iterator<Node,
Bucket> const& other) const BOOST_NOEXCEPT Bucket> const& other) const noexcept
{ {
return !equal(other); return !equal(other);
} }
@ -1797,17 +1797,11 @@ namespace boost {
{ {
} }
value_type const& dereference() const BOOST_NOEXCEPT value_type const& dereference() const noexcept { return p->value(); }
{
return p->value();
}
bool equal(const c_iterator& x) const BOOST_NOEXCEPT bool equal(const c_iterator& x) const noexcept { return (p == x.p); }
{
return (p == x.p);
}
void increment() BOOST_NOEXCEPT void increment() noexcept
{ {
p = p->next; p = p->next;
if (!p) { if (!p) {
@ -1815,10 +1809,10 @@ namespace boost {
} }
} }
template<typename Archive> template <typename Archive>
friend void serialization_track(Archive& ar, const c_iterator& x) friend void serialization_track(Archive& ar, const c_iterator& x)
{ {
if(x.p){ if (x.p) {
track_address(ar, x.p); track_address(ar, x.p);
serialization_track(ar, x.itb); serialization_track(ar, x.itb);
} }
@ -1826,12 +1820,12 @@ namespace boost {
friend class boost::serialization::access; friend class boost::serialization::access;
template<typename Archive> template <typename Archive> void serialize(Archive& ar, unsigned int)
void serialize(Archive& ar,unsigned int)
{ {
if(!p) itb = bucket_iterator(); if (!p)
itb = bucket_iterator();
serialize_tracked_address(ar, p); serialize_tracked_address(ar, p);
ar & core::make_nvp("bucket_iterator", itb); ar& core::make_nvp("bucket_iterator", itb);
} }
}; };
} // namespace iterator_detail } // namespace iterator_detail
@ -1859,20 +1853,23 @@ namespace boost {
functions; functions;
typedef typename Types::value_allocator value_allocator; typedef typename Types::value_allocator value_allocator;
typedef typename boost::allocator_void_pointer<value_allocator>::type void_pointer; typedef typename boost::allocator_void_pointer<value_allocator>::type
void_pointer;
typedef node<value_type, void_pointer> node_type; typedef node<value_type, void_pointer> node_type;
typedef boost::unordered::detail::grouped_bucket_array< typedef boost::unordered::detail::grouped_bucket_array<
bucket<node_type, void_pointer>, value_allocator, prime_fmod_size<> > bucket<node_type, void_pointer>, value_allocator, prime_fmod_size<> >
bucket_array_type; bucket_array_type;
typedef typename bucket_array_type::node_allocator_type typedef
node_allocator_type; typename bucket_array_type::node_allocator_type node_allocator_type;
typedef typename boost::allocator_pointer<node_allocator_type>::type node_pointer; typedef typename boost::allocator_pointer<node_allocator_type>::type
node_pointer;
typedef boost::unordered::detail::node_constructor<node_allocator_type> typedef boost::unordered::detail::node_constructor<node_allocator_type>
node_constructor; node_constructor;
typedef boost::unordered::detail::node_tmp<node_allocator_type> node_tmp; typedef boost::unordered::detail::node_tmp<node_allocator_type>
node_tmp;
typedef typename bucket_array_type::bucket_type bucket_type; typedef typename bucket_array_type::bucket_type bucket_type;
@ -1919,8 +1916,7 @@ namespace boost {
} }
std::size_t c = 0; std::size_t c = 0;
std::size_t const key_hash = this->hash(k); std::size_t const key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
bool found = false; bool found = false;
@ -1962,10 +1958,7 @@ namespace boost {
return iterator(itb->next, itb); return iterator(itb->next, itb);
} }
iterator end() const iterator end() const { return iterator(); }
{
return iterator();
}
l_iterator begin(std::size_t bucket_index) const l_iterator begin(std::size_t bucket_index) const
{ {
@ -2142,8 +2135,7 @@ namespace boost {
return; return;
} }
BOOST_ASSERT( BOOST_ASSERT(buckets_.bucket_count() == src.buckets_.bucket_count());
buckets_.bucket_count() == src.buckets_.bucket_count());
this->reserve(src.size_); this->reserve(src.size_);
for (iterator pos = src.begin(); pos != src.end(); ++pos) { for (iterator pos = src.begin(); pos != src.end(); ++pos) {
@ -2154,8 +2146,7 @@ namespace boost {
const_key_type& k = this->get_key(b.node_); const_key_type& k = this->get_key(b.node_);
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
buckets_.insert_node(itb, b.release()); buckets_.insert_node(itb, b.release());
++size_; ++size_;
} }
@ -2201,7 +2192,9 @@ namespace boost {
template <typename UniqueType> template <typename UniqueType>
void assign(table const& x, UniqueType is_unique) void assign(table const& x, UniqueType is_unique)
{ {
typedef typename boost::allocator_propagate_on_container_copy_assignment<node_allocator_type>::type pocca; typedef
typename boost::allocator_propagate_on_container_copy_assignment<
node_allocator_type>::type pocca;
if (this != &x) { if (this != &x) {
assign(x, is_unique, assign(x, is_unique,
@ -2211,7 +2204,7 @@ namespace boost {
} }
template <typename UniqueType> template <typename UniqueType>
void assign(table const &x, UniqueType is_unique, false_type) void assign(table const& x, UniqueType is_unique, false_type)
{ {
// Strong exception safety. // Strong exception safety.
this->construct_spare_functions(x.current_functions()); this->construct_spare_functions(x.current_functions());
@ -2234,15 +2227,12 @@ namespace boost {
} }
template <typename UniqueType> template <typename UniqueType>
void assign(table const &x, UniqueType is_unique, true_type) void assign(table const& x, UniqueType is_unique, true_type)
{ {
if (node_alloc() == x.node_alloc()) if (node_alloc() == x.node_alloc()) {
{
buckets_.reset_allocator(x.node_alloc()); buckets_.reset_allocator(x.node_alloc());
assign(x, is_unique, false_type()); assign(x, is_unique, false_type());
} } else {
else
{
bucket_array_type new_buckets(x.size_, x.node_alloc()); bucket_array_type new_buckets(x.size_, x.node_alloc());
this->construct_spare_functions(x.current_functions()); this->construct_spare_functions(x.current_functions());
this->switch_functions(); this->switch_functions();
@ -2258,8 +2248,7 @@ namespace boost {
reserve(x.size_); reserve(x.size_);
// Finally copy the elements. // Finally copy the elements.
if (x.size_) if (x.size_) {
{
copy_buckets(x, is_unique); copy_buckets(x, is_unique);
} }
} }
@ -2347,8 +2336,7 @@ namespace boost {
return extractor::extract(n->value()); return extractor::extract(n->value());
} }
template <class Key> template <class Key> std::size_t hash(Key const& k) const
std::size_t hash(Key const& k) const
{ {
return this->hash_function()(k); return this->hash_function()(k);
} }
@ -2356,8 +2344,7 @@ namespace boost {
// Find Node // Find Node
template <class Key> template <class Key>
node_pointer find_node_impl( node_pointer find_node_impl(Key const& x, bucket_iterator itb) const
Key const& x, bucket_iterator itb) const
{ {
node_pointer p = node_pointer(); node_pointer p = node_pointer();
if (itb != buckets_.end()) { if (itb != buckets_.end()) {
@ -2375,12 +2362,10 @@ namespace boost {
template <class Key> node_pointer find_node(Key const& k) const template <class Key> node_pointer find_node(Key const& k) const
{ {
std::size_t const key_hash = this->hash(k); std::size_t const key_hash = this->hash(k);
return find_node_impl( return find_node_impl(k, buckets_.at(buckets_.position(key_hash)));
k, buckets_.at(buckets_.position(key_hash)));
} }
node_pointer find_node( node_pointer find_node(const_key_type& k, bucket_iterator itb) const
const_key_type& k, bucket_iterator itb) const
{ {
return find_node_impl(k, itb); return find_node_impl(k, itb);
} }
@ -2414,7 +2399,7 @@ namespace boost {
if (size_ > 0) { if (size_ > 0) {
key_equal pred = this->key_eq(); key_equal pred = this->key_eq();
for (node_pointer* pp = boost::addressof(itb->next); *pp; for (node_pointer* pp = boost::addressof(itb->next); *pp;
pp = boost::addressof((*pp)->next)) { pp = boost::addressof((*pp)->next)) {
if (pred(key, extractor::extract((*pp)->value()))) { if (pred(key, extractor::extract((*pp)->value()))) {
return pp; return pp;
} }
@ -2508,8 +2493,7 @@ namespace boost {
const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS) const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS)
{ {
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer pos = this->find_node_impl(k, itb); node_pointer pos = this->find_node_impl(k, itb);
if (pos) { if (pos) {
@ -2546,8 +2530,7 @@ namespace boost {
} }
std::size_t const key_hash = this->hash(k); std::size_t const key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer p = this->find_node_impl(k, itb); node_pointer p = this->find_node_impl(k, itb);
if (p) { if (p) {
@ -2575,8 +2558,7 @@ namespace boost {
const_key_type& k = this->get_key(b.node_); const_key_type& k = this->get_key(b.node_);
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer pos = this->find_node_impl(k, itb); node_pointer pos = this->find_node_impl(k, itb);
if (pos) { if (pos) {
@ -2599,8 +2581,7 @@ namespace boost {
emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k) emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k)
{ {
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer pos = this->find_node_impl(k, itb); node_pointer pos = this->find_node_impl(k, itb);
@ -2643,8 +2624,7 @@ namespace boost {
BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS) BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS)
{ {
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer pos = this->find_node_impl(k, itb); node_pointer pos = this->find_node_impl(k, itb);
@ -2685,8 +2665,7 @@ namespace boost {
BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj) BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj)
{ {
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer p = this->find_node_impl(k, itb); node_pointer p = this->find_node_impl(k, itb);
if (p) { if (p) {
@ -2723,8 +2702,7 @@ namespace boost {
const_key_type& k = this->get_key(np.ptr_); const_key_type& k = this->get_key(np.ptr_);
std::size_t const key_hash = this->hash(k); std::size_t const key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer p = this->find_node_impl(k, itb); node_pointer p = this->find_node_impl(k, itb);
if (p) { if (p) {
@ -2762,8 +2740,7 @@ namespace boost {
} }
std::size_t const key_hash = this->hash(k); std::size_t const key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer p = this->find_node_impl(k, itb); node_pointer p = this->find_node_impl(k, itb);
if (p) { if (p) {
return iterator(p, itb); return iterator(p, itb);
@ -2786,8 +2763,8 @@ namespace boost {
void merge_unique(boost::unordered::detail::table<Types2>& other) void merge_unique(boost::unordered::detail::table<Types2>& other)
{ {
typedef boost::unordered::detail::table<Types2> other_table; typedef boost::unordered::detail::table<Types2> other_table;
BOOST_STATIC_ASSERT((boost::is_same<node_type, BOOST_STATIC_ASSERT((
typename other_table::node_type>::value)); boost::is_same<node_type, typename other_table::node_type>::value));
BOOST_ASSERT(this->node_alloc() == other.node_alloc()); BOOST_ASSERT(this->node_alloc() == other.node_alloc());
if (other.size_ == 0) { if (other.size_ == 0) {
@ -2801,8 +2778,7 @@ namespace boost {
const_key_type& key = other.get_key(pos.p); const_key_type& key = other.get_key(pos.p);
std::size_t const key_hash = this->hash(key); std::size_t const key_hash = this->hash(key);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
if (this->find_node_impl(key, itb)) { if (this->find_node_impl(key, itb)) {
++pos; ++pos;
@ -2887,10 +2863,11 @@ namespace boost {
return 1; return 1;
} }
iterator erase_node(c_iterator pos) { iterator erase_node(c_iterator pos)
{
c_iterator next = pos; c_iterator next = pos;
++next; ++next;
bucket_iterator itb = pos.itb; bucket_iterator itb = pos.itb;
node_pointer* pp = boost::addressof(itb->next); node_pointer* pp = boost::addressof(itb->next);
while (*pp != pos.p) { while (*pp != pos.p) {
@ -2927,7 +2904,6 @@ namespace boost {
this->delete_node(p); this->delete_node(p);
--size_; --size_;
bool const at_end = !(*pp); bool const at_end = !(*pp);
bool const is_empty_bucket = !itb->next; bool const is_empty_bucket = !itb->next;
@ -3022,8 +2998,8 @@ namespace boost {
return true; return true;
} }
static bool group_equals_equiv(iterator n1, iterator end1, static bool group_equals_equiv(
iterator n2, iterator end2) iterator n1, iterator end1, iterator n2, iterator end2)
{ {
for (;;) { for (;;) {
if (*n1 != *n2) if (*n1 != *n2)
@ -3071,8 +3047,7 @@ namespace boost {
return true; return true;
} }
static bool find_equiv( static bool find_equiv(iterator n, iterator last, value_type const& v)
iterator n, iterator last, value_type const& v)
{ {
for (; n != last; ++n) for (; n != last; ++n)
if (*n == v) if (*n == v)
@ -3097,8 +3072,7 @@ namespace boost {
node_tmp a(n, this->node_alloc()); node_tmp a(n, this->node_alloc());
const_key_type& k = this->get_key(a.node_); const_key_type& k = this->get_key(a.node_);
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer hint = this->find_node_impl(k, itb); node_pointer hint = this->find_node_impl(k, itb);
if (size_ + 1 > max_load_) { if (size_ + 1 > max_load_) {
@ -3166,8 +3140,7 @@ namespace boost {
const_key_type& k = this->get_key(np.ptr_); const_key_type& k = this->get_key(np.ptr_);
std::size_t key_hash = this->hash(k); std::size_t key_hash = this->hash(k);
bucket_iterator itb = bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
buckets_.at(buckets_.position(key_hash));
node_pointer hint = this->find_node_impl(k, itb); node_pointer hint = this->find_node_impl(k, itb);
buckets_.insert_node_hint(itb, np.ptr_, hint); buckets_.insert_node_hint(itb, np.ptr_, hint);
@ -3634,9 +3607,9 @@ namespace boost {
return (size - c.size()); return (size - c.size());
} }
} } // namespace detail
} } // namespace unordered
} } // namespace boost
#undef BOOST_UNORDERED_EMPLACE_TEMPLATE #undef BOOST_UNORDERED_EMPLACE_TEMPLATE
#undef BOOST_UNORDERED_EMPLACE_ARGS #undef BOOST_UNORDERED_EMPLACE_ARGS

View File

@ -19,7 +19,7 @@ namespace unordered{
namespace detail{ namespace detail{
template<typename To,typename From> template<typename To,typename From>
BOOST_CONSTEXPR To narrow_cast(From x) BOOST_NOEXCEPT BOOST_CONSTEXPR To narrow_cast(From x) noexcept
{ {
BOOST_STATIC_ASSERT(boost::is_integral<From>::value); BOOST_STATIC_ASSERT(boost::is_integral<From>::value);
BOOST_STATIC_ASSERT(boost::is_integral<To>::value); BOOST_STATIC_ASSERT(boost::is_integral<To>::value);

View File

@ -14,15 +14,15 @@
#pragma once #pragma once
#endif #endif
#include <boost/unordered/detail/map.hpp>
#include <boost/unordered/detail/requires_cxx11.hpp> #include <boost/unordered/detail/requires_cxx11.hpp>
#include <boost/config.hpp> #include <boost/unordered/detail/serialize_fca_container.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/core/explicit_operator_bool.hpp> #include <boost/core/explicit_operator_bool.hpp>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/move/move.hpp> #include <boost/move/move.hpp>
#include <boost/type_traits/is_constructible.hpp> #include <boost/type_traits/is_constructible.hpp>
#include <boost/unordered/detail/map.hpp>
#include <boost/unordered/detail/serialize_fca_container.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>
@ -99,10 +99,10 @@ namespace boost {
unordered_map(unordered_map const&); unordered_map(unordered_map const&);
#if defined(BOOST_UNORDERED_USE_MOVE) || \ #if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_map(BOOST_RV_REF(unordered_map) other) unordered_map(BOOST_RV_REF(unordered_map) other)
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible) noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
// The move is done in table_ // The move is done in table_
@ -148,9 +148,9 @@ namespace boost {
// Destructor // Destructor
~unordered_map() BOOST_NOEXCEPT; ~unordered_map() noexcept;
// Assign // Assign
#if defined(BOOST_UNORDERED_USE_MOVE) #if defined(BOOST_UNORDERED_USE_MOVE)
unordered_map& operator=(BOOST_COPY_ASSIGN_REF(unordered_map) x) unordered_map& operator=(BOOST_COPY_ASSIGN_REF(unordered_map) x)
@ -160,7 +160,7 @@ namespace boost {
} }
unordered_map& operator=(BOOST_RV_REF(unordered_map) x) unordered_map& operator=(BOOST_RV_REF(unordered_map) x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -176,7 +176,7 @@ namespace boost {
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_map& operator=(unordered_map&& x) unordered_map& operator=(unordered_map&& x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -190,43 +190,43 @@ namespace boost {
unordered_map& operator=(std::initializer_list<value_type>); unordered_map& operator=(std::initializer_list<value_type>);
#endif #endif
allocator_type get_allocator() const BOOST_NOEXCEPT allocator_type get_allocator() const noexcept
{ {
return table_.node_alloc(); return table_.node_alloc();
} }
// // iterators // // iterators
iterator begin() BOOST_NOEXCEPT { return table_.begin(); } iterator begin() noexcept { return table_.begin(); }
const_iterator begin() const BOOST_NOEXCEPT const_iterator begin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
iterator end() BOOST_NOEXCEPT { return iterator(); } iterator end() noexcept { return iterator(); }
const_iterator end() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator end() const noexcept { return const_iterator(); }
const_iterator cbegin() const BOOST_NOEXCEPT const_iterator cbegin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator cend() const noexcept { return const_iterator(); }
// size and capacity // size and capacity
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{ {
return table_.size_ == 0; return table_.size_ == 0;
} }
size_type size() const BOOST_NOEXCEPT { return table_.size_; } size_type size() const noexcept { return table_.size_; }
size_type max_size() const BOOST_NOEXCEPT; size_type max_size() const noexcept;
// emplace // emplace
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@ -397,7 +397,8 @@ namespace boost {
template <class P2> template <class P2>
typename boost::enable_if< typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>, boost::is_constructible<value_type, BOOST_RV_REF(P2)>,
std::pair<iterator, bool> >::type insert(BOOST_RV_REF(P2) obj) std::pair<iterator, bool> >::type
insert(BOOST_RV_REF(P2) obj)
{ {
return this->emplace(boost::forward<P2>(obj)); return this->emplace(boost::forward<P2>(obj));
} }
@ -647,18 +648,18 @@ namespace boost {
iterator try_emplace( iterator try_emplace(
const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0) const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0)
{ {
return table_.try_emplace_hint_unique( return table_.try_emplace_hint_unique(hint, k,
hint, k, boost::unordered::detail::create_emplace_args( boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0))); boost::forward<A0>(a0)));
} }
template <typename A0, typename A1> template <typename A0, typename A1>
iterator try_emplace(const_iterator hint, key_type const& k, iterator try_emplace(const_iterator hint, key_type const& k,
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{ {
return table_.try_emplace_hint_unique( return table_.try_emplace_hint_unique(hint, k,
hint, k, boost::unordered::detail::create_emplace_args( boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1))); boost::forward<A0>(a0), boost::forward<A1>(a1)));
} }
template <typename A0, typename A1, typename A2> template <typename A0, typename A1, typename A2>
@ -676,9 +677,9 @@ namespace boost {
iterator try_emplace( iterator try_emplace(
const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
{ {
return table_.try_emplace_hint_unique( return table_.try_emplace_hint_unique(hint, boost::move(k),
hint, boost::move(k), boost::unordered::detail::create_emplace_args( boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0))); boost::forward<A0>(a0)));
} }
template <typename A0, typename A1> template <typename A0, typename A1>
@ -761,9 +762,9 @@ namespace boost {
iterator try_emplace(const_iterator hint, key_type const& k, \ iterator try_emplace(const_iterator hint, key_type const& k, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \ BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \ { \
return table_.try_emplace_hint_unique( \ return table_.try_emplace_hint_unique(hint, k, \
hint, k, boost::unordered::detail::create_emplace_args( \ boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \ BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
} \ } \
\ \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
@ -860,10 +861,10 @@ namespace boost {
void erase_return_void(const_iterator it) { erase(it); } void erase_return_void(const_iterator it) { erase(it); }
void swap(unordered_map&) void swap(unordered_map&)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::is_nothrow_swappable<P>::value);
void clear() BOOST_NOEXCEPT { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
void merge(boost::unordered_map<K, T, H2, P2, A>& source); void merge(boost::unordered_map<K, T, H2, P2, A>& source);
@ -993,12 +994,9 @@ namespace boost {
// bucket interface // bucket interface
size_type bucket_count() const BOOST_NOEXCEPT size_type bucket_count() const noexcept { return table_.bucket_count(); }
{
return table_.bucket_count();
}
size_type max_bucket_count() const BOOST_NOEXCEPT size_type max_bucket_count() const noexcept
{ {
return table_.max_bucket_count(); return table_.max_bucket_count();
} }
@ -1018,10 +1016,7 @@ namespace boost {
return table_.hash_to_bucket(table_.hash(boost::forward<Key>(k))); return table_.hash_to_bucket(table_.hash(boost::forward<Key>(k)));
} }
local_iterator begin(size_type n) local_iterator begin(size_type n) { return table_.begin(n); }
{
return table_.begin(n);
}
const_local_iterator begin(size_type n) const const_local_iterator begin(size_type n) const
{ {
@ -1046,9 +1041,9 @@ namespace boost {
// hash policy // hash policy
float load_factor() const BOOST_NOEXCEPT; float load_factor() const noexcept;
float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } float max_load_factor() const noexcept { return table_.mlf_; }
void max_load_factor(float) BOOST_NOEXCEPT; void max_load_factor(float) noexcept;
void rehash(size_type); void rehash(size_type);
void reserve(size_type); void reserve(size_type);
@ -1062,7 +1057,7 @@ namespace boost {
template <class Archive, class K, class T, class H, class P, class A> template <class Archive, class K, class T, class H, class P, class A>
void serialize( void serialize(
Archive & ar,unordered_map<K, T, H, P, A>& m,unsigned int version) Archive& ar, unordered_map<K, T, H, P, A>& m, unsigned int version)
{ {
detail::serialize_fca_container(ar, m, version); detail::serialize_fca_container(ar, m, version);
} }
@ -1213,7 +1208,7 @@ namespace boost {
#if defined(BOOST_UNORDERED_USE_MOVE) || \ #if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multimap(BOOST_RV_REF(unordered_multimap) other) unordered_multimap(BOOST_RV_REF(unordered_multimap) other)
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible) noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
// The move is done in table_ // The move is done in table_
@ -1262,9 +1257,9 @@ namespace boost {
// Destructor // Destructor
~unordered_multimap() BOOST_NOEXCEPT; ~unordered_multimap() noexcept;
// Assign // Assign
#if defined(BOOST_UNORDERED_USE_MOVE) #if defined(BOOST_UNORDERED_USE_MOVE)
unordered_multimap& operator=(BOOST_COPY_ASSIGN_REF(unordered_multimap) x) unordered_multimap& operator=(BOOST_COPY_ASSIGN_REF(unordered_multimap) x)
@ -1274,7 +1269,7 @@ namespace boost {
} }
unordered_multimap& operator=(BOOST_RV_REF(unordered_multimap) x) unordered_multimap& operator=(BOOST_RV_REF(unordered_multimap) x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -1290,7 +1285,7 @@ namespace boost {
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multimap& operator=(unordered_multimap&& x) unordered_multimap& operator=(unordered_multimap&& x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -1304,43 +1299,43 @@ namespace boost {
unordered_multimap& operator=(std::initializer_list<value_type>); unordered_multimap& operator=(std::initializer_list<value_type>);
#endif #endif
allocator_type get_allocator() const BOOST_NOEXCEPT allocator_type get_allocator() const noexcept
{ {
return table_.node_alloc(); return table_.node_alloc();
} }
// iterators // iterators
iterator begin() BOOST_NOEXCEPT { return iterator(table_.begin()); } iterator begin() noexcept { return iterator(table_.begin()); }
const_iterator begin() const BOOST_NOEXCEPT const_iterator begin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
iterator end() BOOST_NOEXCEPT { return iterator(); } iterator end() noexcept { return iterator(); }
const_iterator end() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator end() const noexcept { return const_iterator(); }
const_iterator cbegin() const BOOST_NOEXCEPT const_iterator cbegin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator cend() const noexcept { return const_iterator(); }
// size and capacity // size and capacity
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{ {
return table_.size_ == 0; return table_.size_ == 0;
} }
size_type size() const BOOST_NOEXCEPT { return table_.size_; } size_type size() const noexcept { return table_.size_; }
size_type max_size() const BOOST_NOEXCEPT; size_type max_size() const noexcept;
// emplace // emplace
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@ -1504,8 +1499,8 @@ namespace boost {
template <class P2> template <class P2>
typename boost::enable_if< typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>, boost::is_constructible<value_type, BOOST_RV_REF(P2)>, iterator>::type
iterator>::type insert(BOOST_RV_REF(P2) obj) insert(BOOST_RV_REF(P2) obj)
{ {
return this->emplace(boost::forward<P2>(obj)); return this->emplace(boost::forward<P2>(obj));
} }
@ -1522,8 +1517,7 @@ namespace boost {
template <class P2> template <class P2>
typename boost::enable_if< typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>, boost::is_constructible<value_type, BOOST_RV_REF(P2)>, iterator>::type
iterator>::type
insert(const_iterator hint, BOOST_RV_REF(P2) obj) insert(const_iterator hint, BOOST_RV_REF(P2) obj)
{ {
return this->emplace_hint(hint, boost::forward<P2>(obj)); return this->emplace_hint(hint, boost::forward<P2>(obj));
@ -1597,10 +1591,10 @@ namespace boost {
void erase_return_void(const_iterator it) { erase(it); } void erase_return_void(const_iterator it) { erase(it); }
void swap(unordered_multimap&) void swap(unordered_multimap&)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::is_nothrow_swappable<P>::value);
void clear() BOOST_NOEXCEPT { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
void merge(boost::unordered_multimap<K, T, H2, P2, A>& source); void merge(boost::unordered_multimap<K, T, H2, P2, A>& source);
@ -1702,12 +1696,9 @@ namespace boost {
// bucket interface // bucket interface
size_type bucket_count() const BOOST_NOEXCEPT size_type bucket_count() const noexcept { return table_.bucket_count(); }
{
return table_.bucket_count();
}
size_type max_bucket_count() const BOOST_NOEXCEPT size_type max_bucket_count() const noexcept
{ {
return table_.max_bucket_count(); return table_.max_bucket_count();
} }
@ -1756,9 +1747,9 @@ namespace boost {
// hash policy // hash policy
float load_factor() const BOOST_NOEXCEPT; float load_factor() const noexcept;
float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } float max_load_factor() const noexcept { return table_.mlf_; }
void max_load_factor(float) BOOST_NOEXCEPT; void max_load_factor(float) noexcept;
void rehash(size_type); void rehash(size_type);
void reserve(size_type); void reserve(size_type);
@ -1772,7 +1763,7 @@ namespace boost {
template <class Archive, class K, class T, class H, class P, class A> template <class Archive, class K, class T, class H, class P, class A>
void serialize( void serialize(
Archive & ar,unordered_multimap<K, T, H, P, A>& m,unsigned int version) Archive& ar, unordered_multimap<K, T, H, P, A>& m, unsigned int version)
{ {
detail::serialize_fca_container(ar, m, version); detail::serialize_fca_container(ar, m, version);
} }
@ -2023,7 +2014,7 @@ namespace boost {
#endif #endif
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::~unordered_map() BOOST_NOEXCEPT unordered_map<K, T, H, P, A>::~unordered_map() noexcept
{ {
} }
@ -2043,7 +2034,7 @@ namespace boost {
// size and capacity // size and capacity
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
std::size_t unordered_map<K, T, H, P, A>::max_size() const BOOST_NOEXCEPT std::size_t unordered_map<K, T, H, P, A>::max_size() const noexcept
{ {
using namespace std; using namespace std;
@ -2106,7 +2097,7 @@ namespace boost {
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
void unordered_map<K, T, H, P, A>::swap(unordered_map& other) void unordered_map<K, T, H, P, A>::swap(unordered_map& other)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::is_nothrow_swappable<P>::value)
{ {
@ -2236,14 +2227,14 @@ namespace boost {
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::mapped_type& typename unordered_map<K, T, H, P, A>::mapped_type&
unordered_map<K, T, H, P, A>::operator[](const key_type& k) unordered_map<K, T, H, P, A>::operator[](const key_type& k)
{ {
return table_.try_emplace_unique(k).first->second; return table_.try_emplace_unique(k).first->second;
} }
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::mapped_type& typename unordered_map<K, T, H, P, A>::mapped_type&
unordered_map<K, T, H, P, A>::operator[](BOOST_RV_REF(key_type) k) unordered_map<K, T, H, P, A>::operator[](BOOST_RV_REF(key_type) k)
{ {
return table_.try_emplace_unique(boost::move(k)).first->second; return table_.try_emplace_unique(boost::move(k)).first->second;
} }
@ -2335,7 +2326,7 @@ namespace boost {
// hash policy // hash policy
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
float unordered_map<K, T, H, P, A>::load_factor() const BOOST_NOEXCEPT float unordered_map<K, T, H, P, A>::load_factor() const noexcept
{ {
if (table_.size_ == 0) { if (table_.size_ == 0) {
return 0.0f; return 0.0f;
@ -2347,7 +2338,7 @@ namespace boost {
} }
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
void unordered_map<K, T, H, P, A>::max_load_factor(float m) BOOST_NOEXCEPT void unordered_map<K, T, H, P, A>::max_load_factor(float m) noexcept
{ {
table_.max_load_factor(m); table_.max_load_factor(m);
} }
@ -2391,9 +2382,8 @@ namespace boost {
} }
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
inline void swap( inline void swap(unordered_map<K, T, H, P, A>& m1,
unordered_map<K, T, H, P, A>& m1, unordered_map<K, T, H, P, A>& m2) unordered_map<K, T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)))
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)))
{ {
#if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613))
struct dummy struct dummy
@ -2572,15 +2562,16 @@ namespace boost {
#endif #endif
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::~unordered_multimap() BOOST_NOEXCEPT unordered_multimap<K, T, H, P, A>::~unordered_multimap() noexcept
{ {
} }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>& unordered_multimap<K, T, H, P, A>:: unordered_multimap<K, T, H, P, A>&
operator=(std::initializer_list<value_type> list) unordered_multimap<K, T, H, P, A>::operator=(
std::initializer_list<value_type> list)
{ {
this->clear(); this->clear();
this->insert(list.begin(), list.end()); this->insert(list.begin(), list.end());
@ -2592,8 +2583,7 @@ namespace boost {
// size and capacity // size and capacity
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
std::size_t std::size_t unordered_multimap<K, T, H, P, A>::max_size() const noexcept
unordered_multimap<K, T, H, P, A>::max_size() const BOOST_NOEXCEPT
{ {
using namespace std; using namespace std;
@ -2655,7 +2645,7 @@ namespace boost {
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
void unordered_multimap<K, T, H, P, A>::swap(unordered_multimap& other) void unordered_multimap<K, T, H, P, A>::swap(unordered_multimap& other)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::is_nothrow_swappable<P>::value)
{ {
@ -2795,7 +2785,7 @@ namespace boost {
// hash policy // hash policy
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
float unordered_multimap<K, T, H, P, A>::load_factor() const BOOST_NOEXCEPT float unordered_multimap<K, T, H, P, A>::load_factor() const noexcept
{ {
if (table_.size_ == 0) { if (table_.size_ == 0) {
return 0.0f; return 0.0f;
@ -2807,8 +2797,7 @@ namespace boost {
} }
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
void unordered_multimap<K, T, H, P, A>::max_load_factor( void unordered_multimap<K, T, H, P, A>::max_load_factor(float m) noexcept
float m) BOOST_NOEXCEPT
{ {
table_.max_load_factor(m); table_.max_load_factor(m);
} }
@ -2853,8 +2842,7 @@ namespace boost {
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
inline void swap(unordered_multimap<K, T, H, P, A>& m1, inline void swap(unordered_multimap<K, T, H, P, A>& m1,
unordered_multimap<K, T, H, P, A>& m2) unordered_multimap<K, T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)))
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)))
{ {
#if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613))
struct dummy struct dummy
@ -2906,7 +2894,7 @@ namespace boost {
} }
public: public:
BOOST_CONSTEXPR node_handle_map() BOOST_NOEXCEPT : ptr_(), alloc_() {} BOOST_CONSTEXPR node_handle_map() noexcept : ptr_(), alloc_() {}
~node_handle_map() ~node_handle_map()
{ {
@ -2917,7 +2905,7 @@ namespace boost {
} }
} }
node_handle_map(BOOST_RV_REF(node_handle_map) n) BOOST_NOEXCEPT node_handle_map(BOOST_RV_REF(node_handle_map) n) noexcept
: ptr_(n.ptr_), : ptr_(n.ptr_),
alloc_(boost::move(n.alloc_)) alloc_(boost::move(n.alloc_))
{ {
@ -2960,17 +2948,17 @@ namespace boost {
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
bool operator!() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } bool operator!() const noexcept { return ptr_ ? 0 : 1; }
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{ {
return ptr_ ? 0 : 1; return ptr_ ? 0 : 1;
} }
void swap(node_handle_map& n) BOOST_NOEXCEPT_IF( void swap(node_handle_map& n)
boost::allocator_propagate_on_container_swap< noexcept(boost::allocator_propagate_on_container_swap<
value_allocator>::type::value || value_allocator>::type::value ||
boost::allocator_is_always_equal<value_allocator>::type::value) boost::allocator_is_always_equal<value_allocator>::type::value)
{ {
BOOST_ASSERT(!alloc_.has_value() || !n.alloc_.has_value() || BOOST_ASSERT(!alloc_.has_value() || !n.alloc_.has_value() ||
@ -2988,7 +2976,7 @@ namespace boost {
template <class N, class K, class T, class A> template <class N, class K, class T, class A>
void swap(node_handle_map<N, K, T, A>& x, node_handle_map<N, K, T, A>& y) void swap(node_handle_map<N, K, T, A>& x, node_handle_map<N, K, T, A>& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(x.swap(y))) noexcept(noexcept(x.swap(y)))
{ {
x.swap(y); x.swap(y);
} }
@ -3009,10 +2997,10 @@ namespace boost {
insert_return_type_map() : position(), inserted(false), node() {} insert_return_type_map() : position(), inserted(false), node() {}
insert_return_type_map(BOOST_RV_REF(insert_return_type_map) insert_return_type_map(BOOST_RV_REF(insert_return_type_map) x) noexcept
x) BOOST_NOEXCEPT : position(x.position), : position(x.position),
inserted(x.inserted), inserted(x.inserted),
node(boost::move(x.node)) node(boost::move(x.node))
{ {
} }

View File

@ -1,6 +1,6 @@
// Copyright (C) 2008-2011 Daniel James. // Copyright (C) 2008-2011 Daniel James.
// Copyright (C) 2022 Christian Mazakas // Copyright (C) 2022-2023 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying // 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) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -30,9 +30,8 @@ namespace boost {
inline bool operator!=( inline bool operator!=(
unordered_map<K, T, H, P, A> const&, unordered_map<K, T, H, P, A> const&); unordered_map<K, T, H, P, A> const&, unordered_map<K, T, H, P, A> const&);
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
inline void swap( inline void swap(unordered_map<K, T, H, P, A>& m1,
unordered_map<K, T, H, P, A>& m1, unordered_map<K, T, H, P, A>& m2) unordered_map<K, T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)));
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class T, class H, class P, class A, class Predicate> template <class K, class T, class H, class P, class A, class Predicate>
typename unordered_map<K, T, H, P, A>::size_type erase_if( typename unordered_map<K, T, H, P, A>::size_type erase_if(
@ -51,8 +50,7 @@ namespace boost {
unordered_multimap<K, T, H, P, A> const&); unordered_multimap<K, T, H, P, A> const&);
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
inline void swap(unordered_multimap<K, T, H, P, A>& m1, inline void swap(unordered_multimap<K, T, H, P, A>& m1,
unordered_multimap<K, T, H, P, A>& m2) unordered_multimap<K, T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)));
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class T, class H, class P, class A, class Predicate> template <class K, class T, class H, class P, class A, class Predicate>
typename unordered_multimap<K, T, H, P, A>::size_type erase_if( typename unordered_multimap<K, T, H, P, A>::size_type erase_if(
@ -60,13 +58,13 @@ namespace boost {
template <class N, class K, class T, class A> class node_handle_map; template <class N, class K, class T, class A> class node_handle_map;
template <class Iter, class NodeType> struct insert_return_type_map; template <class Iter, class NodeType> struct insert_return_type_map;
} } // namespace unordered
using boost::unordered::swap;
using boost::unordered::unordered_map; using boost::unordered::unordered_map;
using boost::unordered::unordered_multimap; using boost::unordered::unordered_multimap;
using boost::unordered::swap;
using boost::unordered::operator==; using boost::unordered::operator==;
using boost::unordered::operator!=; using boost::unordered::operator!=;
} } // namespace boost
#endif #endif

View File

@ -15,12 +15,13 @@
#endif #endif
#include <boost/unordered/detail/requires_cxx11.hpp> #include <boost/unordered/detail/requires_cxx11.hpp>
#include <boost/unordered/detail/serialize_fca_container.hpp>
#include <boost/unordered/detail/set.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/core/explicit_operator_bool.hpp> #include <boost/core/explicit_operator_bool.hpp>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/move/move.hpp> #include <boost/move/move.hpp>
#include <boost/unordered/detail/set.hpp>
#include <boost/unordered/detail/serialize_fca_container.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>
@ -99,7 +100,7 @@ namespace boost {
#if defined(BOOST_UNORDERED_USE_MOVE) || \ #if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_set(BOOST_RV_REF(unordered_set) other) unordered_set(BOOST_RV_REF(unordered_set) other)
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible) noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
// The move is done in table_ // The move is done in table_
@ -145,9 +146,9 @@ namespace boost {
// Destructor // Destructor
~unordered_set() BOOST_NOEXCEPT; ~unordered_set() noexcept;
// Assign // Assign
#if defined(BOOST_UNORDERED_USE_MOVE) #if defined(BOOST_UNORDERED_USE_MOVE)
unordered_set& operator=(BOOST_COPY_ASSIGN_REF(unordered_set) x) unordered_set& operator=(BOOST_COPY_ASSIGN_REF(unordered_set) x)
@ -157,7 +158,7 @@ namespace boost {
} }
unordered_set& operator=(BOOST_RV_REF(unordered_set) x) unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -173,7 +174,7 @@ namespace boost {
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_set& operator=(unordered_set&& x) unordered_set& operator=(unordered_set&& x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -187,43 +188,43 @@ namespace boost {
unordered_set& operator=(std::initializer_list<value_type>); unordered_set& operator=(std::initializer_list<value_type>);
#endif #endif
allocator_type get_allocator() const BOOST_NOEXCEPT allocator_type get_allocator() const noexcept
{ {
return table_.node_alloc(); return table_.node_alloc();
} }
// iterators // iterators
iterator begin() BOOST_NOEXCEPT { return iterator(table_.begin()); } iterator begin() noexcept { return iterator(table_.begin()); }
const_iterator begin() const BOOST_NOEXCEPT const_iterator begin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
iterator end() BOOST_NOEXCEPT { return iterator(); } iterator end() noexcept { return iterator(); }
const_iterator end() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator end() const noexcept { return const_iterator(); }
const_iterator cbegin() const BOOST_NOEXCEPT const_iterator cbegin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator cend() const noexcept { return const_iterator(); }
// size and capacity // size and capacity
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{ {
return table_.size_ == 0; return table_.size_ == 0;
} }
size_type size() const BOOST_NOEXCEPT { return table_.size_; } size_type size() const noexcept { return table_.size_; }
size_type max_size() const BOOST_NOEXCEPT; size_type max_size() const noexcept;
// emplace // emplace
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@ -488,10 +489,10 @@ namespace boost {
void erase_return_void(const_iterator it) { erase(it); } void erase_return_void(const_iterator it) { erase(it); }
void swap(unordered_set&) void swap(unordered_set&)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::is_nothrow_swappable<P>::value);
void clear() BOOST_NOEXCEPT { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
void merge(boost::unordered_set<T, H2, P2, A>& source); void merge(boost::unordered_set<T, H2, P2, A>& source);
@ -573,12 +574,9 @@ namespace boost {
// bucket interface // bucket interface
size_type bucket_count() const BOOST_NOEXCEPT size_type bucket_count() const noexcept { return table_.bucket_count(); }
{
return table_.bucket_count();
}
size_type max_bucket_count() const BOOST_NOEXCEPT size_type max_bucket_count() const noexcept
{ {
return table_.max_bucket_count(); return table_.max_bucket_count();
} }
@ -627,9 +625,9 @@ namespace boost {
// hash policy // hash policy
float load_factor() const BOOST_NOEXCEPT; float load_factor() const noexcept;
float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } float max_load_factor() const noexcept { return table_.mlf_; }
void max_load_factor(float) BOOST_NOEXCEPT; void max_load_factor(float) noexcept;
void rehash(size_type); void rehash(size_type);
void reserve(size_type); void reserve(size_type);
@ -643,7 +641,7 @@ namespace boost {
template <class Archive, class K, class H, class P, class A> template <class Archive, class K, class H, class P, class A>
void serialize( void serialize(
Archive & ar,unordered_set<K, H, P, A>& c,unsigned int version) Archive& ar, unordered_set<K, H, P, A>& c, unsigned int version)
{ {
detail::serialize_fca_container(ar, c, version); detail::serialize_fca_container(ar, c, version);
} }
@ -782,7 +780,7 @@ namespace boost {
#if defined(BOOST_UNORDERED_USE_MOVE) || \ #if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multiset(BOOST_RV_REF(unordered_multiset) other) unordered_multiset(BOOST_RV_REF(unordered_multiset) other)
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible) noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
// The move is done in table_ // The move is done in table_
@ -831,9 +829,9 @@ namespace boost {
// Destructor // Destructor
~unordered_multiset() BOOST_NOEXCEPT; ~unordered_multiset() noexcept;
// Assign // Assign
#if defined(BOOST_UNORDERED_USE_MOVE) #if defined(BOOST_UNORDERED_USE_MOVE)
unordered_multiset& operator=(BOOST_COPY_ASSIGN_REF(unordered_multiset) x) unordered_multiset& operator=(BOOST_COPY_ASSIGN_REF(unordered_multiset) x)
@ -843,7 +841,7 @@ namespace boost {
} }
unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x) unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -859,7 +857,7 @@ namespace boost {
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multiset& operator=(unordered_multiset&& x) unordered_multiset& operator=(unordered_multiset&& x)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&& boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value) boost::is_nothrow_move_assignable<P>::value)
{ {
@ -873,43 +871,43 @@ namespace boost {
unordered_multiset& operator=(std::initializer_list<value_type>); unordered_multiset& operator=(std::initializer_list<value_type>);
#endif #endif
allocator_type get_allocator() const BOOST_NOEXCEPT allocator_type get_allocator() const noexcept
{ {
return table_.node_alloc(); return table_.node_alloc();
} }
// iterators // iterators
iterator begin() BOOST_NOEXCEPT { return iterator(table_.begin()); } iterator begin() noexcept { return iterator(table_.begin()); }
const_iterator begin() const BOOST_NOEXCEPT const_iterator begin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
iterator end() BOOST_NOEXCEPT { return iterator(); } iterator end() noexcept { return iterator(); }
const_iterator end() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator end() const noexcept { return const_iterator(); }
const_iterator cbegin() const BOOST_NOEXCEPT const_iterator cbegin() const noexcept
{ {
return const_iterator(table_.begin()); return const_iterator(table_.begin());
} }
const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } const_iterator cend() const noexcept { return const_iterator(); }
// size and capacity // size and capacity
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{ {
return table_.size_ == 0; return table_.size_ == 0;
} }
size_type size() const BOOST_NOEXCEPT { return table_.size_; } size_type size() const noexcept { return table_.size_; }
size_type max_size() const BOOST_NOEXCEPT; size_type max_size() const noexcept;
// emplace // emplace
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@ -1148,10 +1146,10 @@ namespace boost {
void erase_return_void(const_iterator it) { erase(it); } void erase_return_void(const_iterator it) { erase(it); }
void swap(unordered_multiset&) void swap(unordered_multiset&)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value); boost::is_nothrow_swappable<P>::value);
void clear() BOOST_NOEXCEPT { table_.clear_impl(); } void clear() noexcept { table_.clear_impl(); }
template <typename H2, typename P2> template <typename H2, typename P2>
void merge(boost::unordered_multiset<T, H2, P2, A>& source); void merge(boost::unordered_multiset<T, H2, P2, A>& source);
@ -1229,12 +1227,9 @@ namespace boost {
// bucket interface // bucket interface
size_type bucket_count() const BOOST_NOEXCEPT size_type bucket_count() const noexcept { return table_.bucket_count(); }
{
return table_.bucket_count();
}
size_type max_bucket_count() const BOOST_NOEXCEPT size_type max_bucket_count() const noexcept
{ {
return table_.max_bucket_count(); return table_.max_bucket_count();
} }
@ -1283,9 +1278,9 @@ namespace boost {
// hash policy // hash policy
float load_factor() const BOOST_NOEXCEPT; float load_factor() const noexcept;
float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } float max_load_factor() const noexcept { return table_.mlf_; }
void max_load_factor(float) BOOST_NOEXCEPT; void max_load_factor(float) noexcept;
void rehash(size_type); void rehash(size_type);
void reserve(size_type); void reserve(size_type);
@ -1299,7 +1294,7 @@ namespace boost {
template <class Archive, class K, class H, class P, class A> template <class Archive, class K, class H, class P, class A>
void serialize( void serialize(
Archive & ar,unordered_multiset<K, H, P, A>& c,unsigned int version) Archive& ar, unordered_multiset<K, H, P, A>& c, unsigned int version)
{ {
detail::serialize_fca_container(ar, c, version); detail::serialize_fca_container(ar, c, version);
} }
@ -1540,7 +1535,7 @@ namespace boost {
#endif #endif
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
unordered_set<T, H, P, A>::~unordered_set() BOOST_NOEXCEPT unordered_set<T, H, P, A>::~unordered_set() noexcept
{ {
} }
@ -1560,7 +1555,7 @@ namespace boost {
// size and capacity // size and capacity
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
std::size_t unordered_set<T, H, P, A>::max_size() const BOOST_NOEXCEPT std::size_t unordered_set<T, H, P, A>::max_size() const noexcept
{ {
using namespace std; using namespace std;
@ -1615,7 +1610,7 @@ namespace boost {
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
void unordered_set<T, H, P, A>::swap(unordered_set& other) void unordered_set<T, H, P, A>::swap(unordered_set& other)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::is_nothrow_swappable<P>::value)
{ {
@ -1723,7 +1718,7 @@ namespace boost {
// hash policy // hash policy
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
float unordered_set<T, H, P, A>::load_factor() const BOOST_NOEXCEPT float unordered_set<T, H, P, A>::load_factor() const noexcept
{ {
if (table_.size_ == 0) { if (table_.size_ == 0) {
return 0.0f; return 0.0f;
@ -1735,7 +1730,7 @@ namespace boost {
} }
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
void unordered_set<T, H, P, A>::max_load_factor(float m) BOOST_NOEXCEPT void unordered_set<T, H, P, A>::max_load_factor(float m) noexcept
{ {
table_.max_load_factor(m); table_.max_load_factor(m);
} }
@ -1779,9 +1774,8 @@ namespace boost {
} }
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
inline void swap( inline void swap(unordered_set<T, H, P, A>& m1,
unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2) unordered_set<T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)))
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)))
{ {
#if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613))
struct dummy struct dummy
@ -1959,7 +1953,7 @@ namespace boost {
#endif #endif
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
unordered_multiset<T, H, P, A>::~unordered_multiset() BOOST_NOEXCEPT unordered_multiset<T, H, P, A>::~unordered_multiset() noexcept
{ {
} }
@ -1979,7 +1973,7 @@ namespace boost {
// size and capacity // size and capacity
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
std::size_t unordered_multiset<T, H, P, A>::max_size() const BOOST_NOEXCEPT std::size_t unordered_multiset<T, H, P, A>::max_size() const noexcept
{ {
using namespace std; using namespace std;
@ -2033,7 +2027,7 @@ namespace boost {
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
void unordered_multiset<T, H, P, A>::swap(unordered_multiset& other) void unordered_multiset<T, H, P, A>::swap(unordered_multiset& other)
BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_swappable<H>::value&& boost::is_nothrow_swappable<H>::value&&
boost::is_nothrow_swappable<P>::value) boost::is_nothrow_swappable<P>::value)
{ {
@ -2146,7 +2140,7 @@ namespace boost {
// hash policy // hash policy
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
float unordered_multiset<T, H, P, A>::load_factor() const BOOST_NOEXCEPT float unordered_multiset<T, H, P, A>::load_factor() const noexcept
{ {
if (table_.size_ == 0) { if (table_.size_ == 0) {
return 0.0f; return 0.0f;
@ -2158,7 +2152,7 @@ namespace boost {
} }
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
void unordered_multiset<T, H, P, A>::max_load_factor(float m) BOOST_NOEXCEPT void unordered_multiset<T, H, P, A>::max_load_factor(float m) noexcept
{ {
table_.max_load_factor(m); table_.max_load_factor(m);
} }
@ -2202,9 +2196,8 @@ namespace boost {
} }
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
inline void swap( inline void swap(unordered_multiset<T, H, P, A>& m1,
unordered_multiset<T, H, P, A>& m1, unordered_multiset<T, H, P, A>& m2) unordered_multiset<T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)))
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)))
{ {
#if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613))
struct dummy struct dummy
@ -2258,10 +2251,7 @@ namespace boost {
} }
public: public:
BOOST_CONSTEXPR node_handle_set() BOOST_NOEXCEPT : ptr_(), BOOST_CONSTEXPR node_handle_set() noexcept : ptr_(), has_alloc_(false) {}
has_alloc_(false)
{
}
~node_handle_set() ~node_handle_set()
{ {
@ -2272,9 +2262,9 @@ namespace boost {
} }
} }
node_handle_set(BOOST_RV_REF(node_handle_set) n) BOOST_NOEXCEPT node_handle_set(BOOST_RV_REF(node_handle_set) n) noexcept
: ptr_(n.ptr_), : ptr_(n.ptr_),
alloc_(boost::move(n.alloc_)) alloc_(boost::move(n.alloc_))
{ {
n.ptr_ = node_pointer(); n.ptr_ = node_pointer();
} }
@ -2310,16 +2300,16 @@ namespace boost {
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
bool operator!() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } bool operator!() const noexcept { return ptr_ ? 0 : 1; }
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{ {
return ptr_ ? 0 : 1; return ptr_ ? 0 : 1;
} }
void swap(node_handle_set& n) BOOST_NOEXCEPT_IF( void swap(node_handle_set& n)
value_allocator_traits::propagate_on_container_swap::value || noexcept(value_allocator_traits::propagate_on_container_swap::value ||
value_allocator_traits::is_always_equal::value) value_allocator_traits::is_always_equal::value)
{ {
BOOST_ASSERT( BOOST_ASSERT(
!alloc_.has_value() || !n.alloc_.has_value() || !alloc_.has_value() || !n.alloc_.has_value() ||
@ -2335,7 +2325,7 @@ namespace boost {
template <typename N, typename T, typename A> template <typename N, typename T, typename A>
void swap(node_handle_set<N, T, A>& x, node_handle_set<N, T, A>& y) void swap(node_handle_set<N, T, A>& x, node_handle_set<N, T, A>& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(x.swap(y))) noexcept(noexcept(x.swap(y)))
{ {
x.swap(y); x.swap(y);
} }
@ -2356,10 +2346,10 @@ namespace boost {
insert_return_type_set() : position(), inserted(false), node() {} insert_return_type_set() : position(), inserted(false), node() {}
insert_return_type_set(BOOST_RV_REF(insert_return_type_set) insert_return_type_set(BOOST_RV_REF(insert_return_type_set) x) noexcept
x) BOOST_NOEXCEPT : position(x.position), : position(x.position),
inserted(x.inserted), inserted(x.inserted),
node(boost::move(x.node)) node(boost::move(x.node))
{ {
} }
@ -2373,8 +2363,8 @@ namespace boost {
}; };
template <class Iter, class NodeType> template <class Iter, class NodeType>
void swap( void swap(insert_return_type_set<Iter, NodeType>& x,
insert_return_type_set<Iter, NodeType>& x, insert_return_type_set<Iter, NodeType>& y) insert_return_type_set<Iter, NodeType>& y)
{ {
boost::core::invoke_swap(x.node, y.node); boost::core::invoke_swap(x.node, y.node);
boost::core::invoke_swap(x.inserted, y.inserted); boost::core::invoke_swap(x.inserted, y.inserted);

View File

@ -29,9 +29,8 @@ namespace boost {
inline bool operator!=( inline bool operator!=(
unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&); unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&);
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
inline void swap( inline void swap(unordered_set<T, H, P, A>& m1,
unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2) unordered_set<T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)));
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class H, class P, class A, class Predicate> template <class K, class H, class P, class A, class Predicate>
typename unordered_set<K, H, P, A>::size_type erase_if( typename unordered_set<K, H, P, A>::size_type erase_if(
@ -48,9 +47,8 @@ namespace boost {
inline bool operator!=(unordered_multiset<T, H, P, A> const&, inline bool operator!=(unordered_multiset<T, H, P, A> const&,
unordered_multiset<T, H, P, A> const&); unordered_multiset<T, H, P, A> const&);
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
inline void swap( inline void swap(unordered_multiset<T, H, P, A>& m1,
unordered_multiset<T, H, P, A>& m1, unordered_multiset<T, H, P, A>& m2) unordered_multiset<T, H, P, A>& m2) noexcept(noexcept(m1.swap(m2)));
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class H, class P, class A, class Predicate> template <class K, class H, class P, class A, class Predicate>
typename unordered_multiset<K, H, P, A>::size_type erase_if( typename unordered_multiset<K, H, P, A>::size_type erase_if(
@ -58,13 +56,13 @@ namespace boost {
template <class N, class T, class A> class node_handle_set; template <class N, class T, class A> class node_handle_set;
template <class Iter, class NodeType> struct insert_return_type_set; template <class Iter, class NodeType> struct insert_return_type_set;
} } // namespace unordered
using boost::unordered::unordered_set;
using boost::unordered::unordered_multiset;
using boost::unordered::swap; using boost::unordered::swap;
using boost::unordered::unordered_multiset;
using boost::unordered::unordered_set;
using boost::unordered::operator==; using boost::unordered::operator==;
using boost::unordered::operator!=; using boost::unordered::operator!=;
} } // namespace boost
#endif #endif

View File

@ -46,7 +46,7 @@ template <class T> int implicit_construct()
#endif #endif
#if !defined(BOOST_NO_CXX11_NOEXCEPT) #if !defined(BOOST_NO_CXX11_NOEXCEPT)
#define TEST_NOEXCEPT_EXPR(x) BOOST_STATIC_ASSERT((BOOST_NOEXCEPT_EXPR(x))); #define TEST_NOEXCEPT_EXPR(x) BOOST_STATIC_ASSERT((noexcept(x)));
#else #else
#define TEST_NOEXCEPT_EXPR(x) #define TEST_NOEXCEPT_EXPR(x)
#endif #endif

View File

@ -62,8 +62,7 @@ namespace noexcept_tests {
typedef boost::hash<int> base; typedef boost::hash<int> base;
public: public:
hash_nothrow(BOOST_RV_REF(hash_nothrow)) hash_nothrow(BOOST_RV_REF(hash_nothrow)) noexcept(nothrow_move_construct)
BOOST_NOEXCEPT_IF(nothrow_move_construct)
{ {
if (!nothrow_move_construct) { if (!nothrow_move_construct) {
test_throw("Move Constructor"); test_throw("Move Constructor");
@ -78,7 +77,7 @@ namespace noexcept_tests {
return *this; return *this;
} }
hash_nothrow& operator=(BOOST_RV_REF(hash_nothrow)) hash_nothrow& operator=(BOOST_RV_REF(hash_nothrow))
BOOST_NOEXCEPT_IF(nothrow_move_assign) noexcept(nothrow_move_assign)
{ {
if (!nothrow_move_assign) { if (!nothrow_move_assign) {
test_throw("Move Assign"); test_throw("Move Assign");
@ -90,8 +89,7 @@ namespace noexcept_tests {
test_throw("Operator"); test_throw("Operator");
return static_cast<base const&>(*this)(x); return static_cast<base const&>(*this)(x);
} }
friend void swap(hash_nothrow&, hash_nothrow&) friend void swap(hash_nothrow&, hash_nothrow&) noexcept(nothrow_swap)
BOOST_NOEXCEPT_IF(nothrow_swap)
{ {
if (!nothrow_swap) { if (!nothrow_swap) {
test_throw("Swap"); test_throw("Swap");
@ -113,7 +111,7 @@ namespace noexcept_tests {
public: public:
equal_to_nothrow(BOOST_RV_REF(equal_to_nothrow)) equal_to_nothrow(BOOST_RV_REF(equal_to_nothrow))
BOOST_NOEXCEPT_IF(nothrow_move_construct) noexcept(nothrow_move_construct)
{ {
if (!nothrow_move_construct) { if (!nothrow_move_construct) {
test_throw("Move Constructor"); test_throw("Move Constructor");
@ -128,7 +126,7 @@ namespace noexcept_tests {
return *this; return *this;
} }
equal_to_nothrow& operator=(BOOST_RV_REF(equal_to_nothrow)) equal_to_nothrow& operator=(BOOST_RV_REF(equal_to_nothrow))
BOOST_NOEXCEPT_IF(nothrow_move_assign) noexcept(nothrow_move_assign)
{ {
if (!nothrow_move_assign) { if (!nothrow_move_assign) {
test_throw("Move Assign"); test_throw("Move Assign");
@ -141,7 +139,7 @@ namespace noexcept_tests {
return x == y; return x == y;
} }
friend void swap(equal_to_nothrow&, equal_to_nothrow&) friend void swap(equal_to_nothrow&, equal_to_nothrow&)
BOOST_NOEXCEPT_IF(nothrow_swap) noexcept(nothrow_swap)
{ {
if (!nothrow_swap) { if (!nothrow_swap) {
test_throw("Swap"); test_throw("Swap");

View File

@ -24,7 +24,7 @@ template <typename T> struct A
A() : i(++count) {} A() : i(++count) {}
template <class U> A(const A<U>& a) BOOST_NOEXCEPT : i(a.i) {} template <class U> A(const A<U>& a) noexcept : i(a.i) {}
T* allocate(std::size_t n) T* allocate(std::size_t n)
{ {
@ -33,7 +33,7 @@ template <typename T> struct A
return (T*)std::calloc(n, sizeof(T)); return (T*)std::calloc(n, sizeof(T));
} }
void deallocate(T* p, std::size_t n) BOOST_NOEXCEPT void deallocate(T* p, std::size_t n) noexcept
{ {
total_allocation -= n * sizeof(T); total_allocation -= n * sizeof(T);
std::free(p); std::free(p);