From aa16d1b8a90753563d9b575089b8c5309ecc08a9 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Mon, 28 Aug 2023 12:24:25 -0700 Subject: [PATCH] Remove BOOST_NOEXCEPT --- include/boost/unordered/detail/fca.hpp | 121 +++--- .../boost/unordered/detail/implementation.hpp | 357 ++++++++---------- .../boost/unordered/detail/narrow_cast.hpp | 2 +- include/boost/unordered/unordered_map.hpp | 218 +++++------ include/boost/unordered/unordered_map_fwd.hpp | 16 +- include/boost/unordered/unordered_set.hpp | 174 ++++----- include/boost/unordered/unordered_set_fwd.hpp | 18 +- test/unordered/compile_tests.hpp | 2 +- test/unordered/noexcept_tests.cpp | 14 +- test/unordered/reserve_tests.cpp | 4 +- 10 files changed, 427 insertions(+), 499 deletions(-) diff --git a/include/boost/unordered/detail/fca.hpp b/include/boost/unordered/detail/fca.hpp index 2a4167dc..bb67948d 100644 --- a/include/boost/unordered/detail/fca.hpp +++ b/include/boost/unordered/detail/fca.hpp @@ -147,14 +147,14 @@ namespace boost { typename boost::aligned_storage::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(buf.address()); } - value_type& value() BOOST_NOEXCEPT + value_type& value() noexcept { return *reinterpret_cast(buf.address()); } @@ -170,7 +170,7 @@ namespace boost { node_pointer next; - bucket() BOOST_NOEXCEPT : next() {} + bucket() noexcept : next() {} }; template struct bucket_group @@ -186,7 +186,7 @@ namespace boost { std::size_t bitmask; bucket_group_pointer next, prev; - bucket_group() BOOST_NOEXCEPT : buckets(), bitmask(0), next(), prev() {} + bucket_group() noexcept : buckets(), bitmask(0), next(), prev() {} ~bucket_group() {} }; @@ -224,33 +224,28 @@ namespace boost { public: grouped_bucket_iterator() : p(), pbg() {} - reference operator*() const BOOST_NOEXCEPT { return dereference(); } - pointer operator->() const BOOST_NOEXCEPT - { - return boost::to_address(p); - } + reference operator*() const noexcept { return dereference(); } + pointer operator->() const noexcept { return boost::to_address(p); } - grouped_bucket_iterator& operator++() BOOST_NOEXCEPT + grouped_bucket_iterator& operator++() noexcept { increment(); return *this; } - grouped_bucket_iterator operator++(int) BOOST_NOEXCEPT + grouped_bucket_iterator operator++(int) noexcept { grouped_bucket_iterator old = *this; increment(); return old; } - bool operator==( - grouped_bucket_iterator const& other) const BOOST_NOEXCEPT + bool operator==(grouped_bucket_iterator const& other) const noexcept { return equal(other); } - bool operator!=( - grouped_bucket_iterator const& other) const BOOST_NOEXCEPT + bool operator!=(grouped_bucket_iterator const& other) const noexcept { 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; } - void increment() BOOST_NOEXCEPT + void increment() noexcept { std::size_t const offset = static_cast(p - pbg->buckets); @@ -290,7 +285,7 @@ namespace boost { } } - template + template friend void serialization_track( Archive& ar, grouped_bucket_iterator const& x) { @@ -301,8 +296,7 @@ namespace boost { friend class boost::serialization::access; - template - void serialize(Archive& ar,unsigned int) + template void serialize(Archive& ar, unsigned int) { // requires: not at end() position serialize_tracked_address(ar, p); @@ -326,20 +320,17 @@ namespace boost { grouped_local_bucket_iterator() : p() {} - reference operator*() const BOOST_NOEXCEPT { return dereference(); } + reference operator*() const noexcept { return dereference(); } - pointer operator->() const BOOST_NOEXCEPT - { - return boost::to_address(p); - } + pointer operator->() const noexcept { return boost::to_address(p); } - grouped_local_bucket_iterator& operator++() BOOST_NOEXCEPT + grouped_local_bucket_iterator& operator++() noexcept { increment(); return *this; } - grouped_local_bucket_iterator operator++(int) BOOST_NOEXCEPT + grouped_local_bucket_iterator operator++(int) noexcept { grouped_local_bucket_iterator old = *this; increment(); @@ -347,13 +338,13 @@ namespace boost { } bool operator==( - grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT + grouped_local_bucket_iterator const& other) const noexcept { return equal(other); } bool operator!=( - grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT + grouped_local_bucket_iterator const& other) const noexcept { return !equal(other); } @@ -366,14 +357,14 @@ namespace boost { 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; } - void increment() BOOST_NOEXCEPT { p = p->next; } + void increment() noexcept { p = p->next; } 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 - { - return boost::to_address(p); - } + pointer operator->() const noexcept { return boost::to_address(p); } - const_grouped_local_bucket_iterator& operator++() BOOST_NOEXCEPT + const_grouped_local_bucket_iterator& operator++() noexcept { increment(); 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; increment(); @@ -418,13 +406,13 @@ namespace boost { } bool operator==( - const_grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT + const_grouped_local_bucket_iterator const& other) const noexcept { return equal(other); } bool operator!=( - const_grouped_local_bucket_iterator const& other) const BOOST_NOEXCEPT + const_grouped_local_bucket_iterator const& other) const noexcept { return !equal(other); } @@ -435,23 +423,22 @@ namespace boost { 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( - const const_grouped_local_bucket_iterator& x) const BOOST_NOEXCEPT + bool equal(const const_grouped_local_bucket_iterator& x) const noexcept { return p == x.p; } - void increment() BOOST_NOEXCEPT { p = p->next; } + void increment() noexcept { p = p->next; } node_pointer p; }; template struct span { - T* begin() const BOOST_NOEXCEPT { return data; } - T* end() const BOOST_NOEXCEPT { return data + size; } + T* begin() const noexcept { return data; } + T* end() const noexcept { return data + size; } T* data; std::size_t size; @@ -532,8 +519,7 @@ namespace boost { grouped_bucket_array(size_type n, const Allocator& al) : empty_value(empty_init_t(), al), - size_index_(0), - size_(0), buckets(), groups() + size_index_(0), size_(0), buckets(), groups() { if (n == 0) { return; @@ -582,8 +568,7 @@ namespace boost { ~grouped_bucket_array() { this->deallocate(); } - grouped_bucket_array( - BOOST_RV_REF(grouped_bucket_array) other) BOOST_NOEXCEPT + grouped_bucket_array(BOOST_RV_REF(grouped_bucket_array) other) noexcept : empty_value( empty_init_t(), other.get_node_allocator()), size_index_(other.size_index_), @@ -598,7 +583,7 @@ namespace boost { } grouped_bucket_array& operator=( - BOOST_RV_REF(grouped_bucket_array) other) BOOST_NOEXCEPT + BOOST_RV_REF(grouped_bucket_array) other) noexcept { BOOST_ASSERT( this->get_node_allocator() == other.get_node_allocator()); @@ -622,7 +607,7 @@ namespace boost { return *this; } - void deallocate() BOOST_NOEXCEPT + void deallocate() noexcept { if (buckets) { bucket_allocator_type bucket_alloc = this->get_bucket_allocator(); @@ -651,7 +636,8 @@ namespace boost { bool b = boost::allocator_propagate_on_container_swap< allocator_type>::type::value; 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(); } - 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 - { - return size_ / group::N + 1; - } + size_type groups_len() const noexcept { return size_ / group::N + 1; } void reset_allocator(Allocator const& allocator_) { @@ -713,7 +696,7 @@ namespace boost { 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 { @@ -747,7 +730,7 @@ namespace boost { size_ = 0; } - void append_bucket_group(iterator itb) BOOST_NOEXCEPT + void append_bucket_group(iterator itb) noexcept { 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); @@ -786,7 +769,7 @@ namespace boost { } 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); @@ -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); while ((*pp) != p) @@ -809,14 +792,14 @@ namespace boost { 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; if (!itb->next) unlink_bucket(itb); } - void unlink_empty_buckets() BOOST_NOEXCEPT + void unlink_empty_buckets() noexcept { std::size_t const N = group::N; @@ -864,7 +847,7 @@ namespace boost { } }; } // namespace detail - } // namespace unordered + } // namespace unordered } // namespace boost #endif // BOOST_UNORDERED_DETAIL_FCA_HPP diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index f353365c..ff5aa86b 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -1,7 +1,7 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. // Copyright (C) 2005-2016 Daniel James // 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 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -14,6 +14,11 @@ #pragma once #endif +#include +#include +#include +#include + #include #include #include @@ -47,12 +52,9 @@ #include #include #include -#include -#include -#include -#include #include #include + #include #include #include @@ -63,8 +65,8 @@ #endif #if BOOST_UNORDERED_CXX11_CONSTRUCTION -#include #include +#include #endif // BOOST_UNORDERED_SUPPRESS_DEPRECATED @@ -125,7 +127,7 @@ namespace boost { template inline void ignore_unused_variable_warning(T const&) { } - } + } // namespace func ////////////////////////////////////////////////////////////////////////// // iterator SFINAE @@ -138,20 +140,20 @@ namespace boost { template struct enable_if_forward - : boost::enable_if_c::value, - ReturnType> + : boost::enable_if_c::value, + ReturnType> { }; template struct disable_if_forward - : boost::disable_if_c::value, - ReturnType> + : boost::disable_if_c::value, + ReturnType> { }; - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost namespace boost { namespace unordered { @@ -169,7 +171,8 @@ namespace boost { template inline typename boost::unordered::detail::disable_if_forward::type insert_size(I, I) + std::size_t>::type + insert_size(I, I) { return 1; } @@ -211,8 +214,8 @@ namespace boost { template struct compressed - : private boost::unordered::detail::generate_base::type, - private boost::unordered::detail::generate_base::type + : private boost::unordered::detail::generate_base::type, + private boost::unordered::detail::generate_base::type { typedef typename generate_base::type base1; typedef typename generate_base::type base2; @@ -353,9 +356,9 @@ namespace boost { { template convert_from_anything(T const&); }; - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost //////////////////////////////////////////////////////////////////////////// // emplace_args @@ -412,7 +415,7 @@ namespace boost { \ template \ inline BOOST_PP_CAT(emplace_args, n) \ - 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) e( \ BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \ @@ -477,9 +480,9 @@ namespace boost { BOOST_UNORDERED_EARGS(1, 9, _) BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), BOOST_UNORDERED_EARGS, _) - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost #undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS #undef BOOST_UNORDERED_EARGS_MEMBER @@ -496,16 +499,16 @@ namespace boost { namespace unordered { namespace detail { -//////////////////////////////////////////////////////////////////////////// -// Integral_constrant, true_type, false_type -// -// Uses the standard versions if available. + //////////////////////////////////////////////////////////////////////////// + // Integral_constrant, true_type, false_type + // + // Uses the standard versions if available. #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) + using std::false_type; using std::integral_constant; using std::true_type; - using std::false_type; #else @@ -523,8 +526,8 @@ namespace boost { #endif -//////////////////////////////////////////////////////////////////////////// -// Explicitly call a destructor + //////////////////////////////////////////////////////////////////////////// + // Explicitly call a destructor #if defined(BOOST_MSVC) #pragma warning(push) @@ -533,7 +536,7 @@ namespace boost { namespace func { template inline void destroy(T* x) { x->~T(); } - } + } // namespace func #if defined(BOOST_MSVC) #pragma warning(pop) @@ -596,7 +599,7 @@ namespace boost { } public: - optional() BOOST_NOEXCEPT : has_value_(false) {} + optional() noexcept : has_value_(false) {} optional(BOOST_RV_REF(optional) x) : has_value_(false) { @@ -650,9 +653,9 @@ namespace boost { friend void swap(optional& x, optional& y) { x.swap(y); } }; - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost //////////////////////////////////////////////////////////////////////////////// // @@ -672,9 +675,9 @@ namespace boost { struct rebind_wrap : boost::allocator_rebind { }; - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost //////////////////////////////////////////////////////////////////////////// // Functions used to construct nodes. Emulates variadic construction, @@ -699,10 +702,10 @@ namespace boost { { new ((void*)address) T(boost::forward(args)...); } - } - } - } -} + } // namespace func + } // namespace detail + } // namespace unordered +} // namespace boost #else @@ -720,10 +723,10 @@ namespace boost { { new ((void*)address) T(boost::forward(a0)); } - } - } - } -} + } // namespace func + } // namespace detail + } // namespace unordered +} // namespace boost #endif @@ -769,10 +772,10 @@ namespace boost { BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 8, boost) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 9, boost) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 10, boost) - } - } - } -} + } // namespace func + } // namespace detail + } // namespace unordered +} // namespace boost #endif @@ -800,10 +803,10 @@ namespace boost { BOOST_PP_REPEAT_FROM_TO(6, BOOST_PP_INC(BOOST_UNORDERED_TUPLE_ARGS), BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE, std) #endif - } - } - } -} + } // namespace func + } // namespace detail + } // namespace unordered +} // namespace boost #endif @@ -866,10 +869,10 @@ namespace boost { boost::tuples::length::value>(), alloc, ptr, x); } - } - } - } -} + } // namespace func + } // namespace detail + } // namespace unordered +} // namespace boost #undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE #undef BOOST_UNORDERED_GET_TUPLE_ARG @@ -937,7 +940,7 @@ namespace boost { to_std_tuple_impl(boost::mp11::mp_list, boost::tuple& tuple, boost::mp11::index_sequence) { - (void) tuple; + (void)tuple; return std::tuple::type...>( boost::get(tuple)...); } @@ -1041,7 +1044,7 @@ namespace boost { boost::forward(args.a1), boost::forward(args.a2)); } -// Use a macro for the rest. + // Use a macro for the rest. #define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ template value_ptr(), std::piecewise_construct, + boost::allocator_construct(val_alloc, a.node_->value_ptr(), + std::piecewise_construct, std::forward_as_tuple(boost::forward(k)), std::forward_as_tuple()); return a.release(); @@ -1409,9 +1412,9 @@ namespace boost { return construct_node_pair(alloc, boost::forward(k)); } } // namespace func - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost #if defined(BOOST_MSVC) #pragma warning(pop) @@ -1437,12 +1440,12 @@ namespace boost { // in that region of storage. This warning is also generated in C++03 // which does not have `std::launder`. The compiler builtin is always // available, regardless of the C++ standard used when compiling. - template T* launder(T* p) BOOST_NOEXCEPT + template T* launder(T* p) noexcept { return __builtin_launder(p); } #else - template T* launder(T* p) BOOST_NOEXCEPT { return p; } + template T* launder(T* p) noexcept { return p; } #endif template class functions @@ -1566,9 +1569,9 @@ namespace boost { } }; -//////////////////////////////////////////////////////////////////////////// -// rvalue parameters when type can't be a BOOST_RV_REF(T) parameter -// e.g. for int + //////////////////////////////////////////////////////////////////////////// + // rvalue parameters when type can't be a BOOST_RV_REF(T) parameter + // e.g. for int #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T) @@ -1626,48 +1629,48 @@ namespace boost { typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; - iterator() : p(), itb(){} + iterator() : p(), itb() {} - reference operator*() const BOOST_NOEXCEPT { return dereference(); } - pointer operator->() const BOOST_NOEXCEPT + reference operator*() const noexcept { return dereference(); } + pointer operator->() const noexcept { pointer x = boost::addressof(p->value()); return x; } - iterator& operator++() BOOST_NOEXCEPT + iterator& operator++() noexcept { increment(); return *this; } - iterator operator++(int) BOOST_NOEXCEPT + iterator operator++(int) noexcept { iterator old = *this; increment(); return old; } - bool operator==(iterator const& other) const BOOST_NOEXCEPT + bool operator==(iterator const& other) const noexcept { return equal(other); } - bool operator!=(iterator const& other) const BOOST_NOEXCEPT + bool operator!=(iterator const& other) const noexcept { return !equal(other); } bool operator==( boost::unordered::detail::iterator_detail::c_iterator const& other) const BOOST_NOEXCEPT + Bucket> const& other) const noexcept { return equal(other); } bool operator!=( boost::unordered::detail::iterator_detail::c_iterator const& other) const BOOST_NOEXCEPT + Bucket> const& other) const noexcept { return !equal(other); } @@ -1684,21 +1687,18 @@ namespace boost { 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 - { - return (p == x.p); - } + bool equal(const iterator& x) const noexcept { return (p == x.p); } bool equal( const boost::unordered::detail::iterator_detail::c_iterator& x) const BOOST_NOEXCEPT + Bucket>& x) const noexcept { return (p == x.p); } - void increment() BOOST_NOEXCEPT + void increment() noexcept { p = p->next; if (!p) { @@ -1706,10 +1706,10 @@ namespace boost { } } - template + template friend void serialization_track(Archive& ar, const iterator& x) { - if(x.p){ + if (x.p) { track_address(ar, x.p); serialization_track(ar, x.itb); } @@ -1717,12 +1717,12 @@ namespace boost { friend class boost::serialization::access; - template - void serialize(Archive& ar,unsigned int) + template void serialize(Archive& ar, unsigned int) { - if(!p) itb = bucket_iterator(); + if (!p) + itb = bucket_iterator(); 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::forward_iterator_tag iterator_category; - c_iterator() : p(), itb(){} + c_iterator() : p(), itb() {} c_iterator(iterator it) : p(it.p), itb(it.itb) {} - reference operator*() const BOOST_NOEXCEPT { return dereference(); } - pointer operator->() const BOOST_NOEXCEPT + reference operator*() const noexcept { return dereference(); } + pointer operator->() const noexcept { pointer x = boost::addressof(p->value()); return x; } - c_iterator& operator++() BOOST_NOEXCEPT + c_iterator& operator++() noexcept { increment(); return *this; } - c_iterator operator++(int) BOOST_NOEXCEPT + c_iterator operator++(int) noexcept { c_iterator old = *this; increment(); return old; } - bool operator==(c_iterator const& other) const BOOST_NOEXCEPT + bool operator==(c_iterator const& other) const noexcept { return equal(other); } - bool operator!=(c_iterator const& other) const BOOST_NOEXCEPT + bool operator!=(c_iterator const& other) const noexcept { return !equal(other); } bool operator==( boost::unordered::detail::iterator_detail::iterator const& other) const BOOST_NOEXCEPT + Bucket> const& other) const noexcept { return equal(other); } bool operator!=( boost::unordered::detail::iterator_detail::iterator const& other) const BOOST_NOEXCEPT + Bucket> const& other) const noexcept { return !equal(other); } @@ -1797,17 +1797,11 @@ namespace boost { { } - value_type const& dereference() const BOOST_NOEXCEPT - { - return p->value(); - } + value_type const& dereference() const noexcept { return p->value(); } - bool equal(const c_iterator& x) const BOOST_NOEXCEPT - { - return (p == x.p); - } + bool equal(const c_iterator& x) const noexcept { return (p == x.p); } - void increment() BOOST_NOEXCEPT + void increment() noexcept { p = p->next; if (!p) { @@ -1815,10 +1809,10 @@ namespace boost { } } - template + template friend void serialization_track(Archive& ar, const c_iterator& x) { - if(x.p){ + if (x.p) { track_address(ar, x.p); serialization_track(ar, x.itb); } @@ -1826,12 +1820,12 @@ namespace boost { friend class boost::serialization::access; - template - void serialize(Archive& ar,unsigned int) + template void serialize(Archive& ar, unsigned int) { - if(!p) itb = bucket_iterator(); + if (!p) + itb = bucket_iterator(); serialize_tracked_address(ar, p); - ar & core::make_nvp("bucket_iterator", itb); + ar& core::make_nvp("bucket_iterator", itb); } }; } // namespace iterator_detail @@ -1859,20 +1853,23 @@ namespace boost { functions; typedef typename Types::value_allocator value_allocator; - typedef typename boost::allocator_void_pointer::type void_pointer; + typedef typename boost::allocator_void_pointer::type + void_pointer; typedef node node_type; typedef boost::unordered::detail::grouped_bucket_array< bucket, value_allocator, prime_fmod_size<> > bucket_array_type; - typedef typename bucket_array_type::node_allocator_type - node_allocator_type; - typedef typename boost::allocator_pointer::type node_pointer; + typedef + typename bucket_array_type::node_allocator_type node_allocator_type; + typedef typename boost::allocator_pointer::type + node_pointer; typedef boost::unordered::detail::node_constructor node_constructor; - typedef boost::unordered::detail::node_tmp node_tmp; + typedef boost::unordered::detail::node_tmp + node_tmp; typedef typename bucket_array_type::bucket_type bucket_type; @@ -1919,8 +1916,7 @@ namespace boost { } std::size_t c = 0; std::size_t const key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); bool found = false; @@ -1962,10 +1958,7 @@ namespace boost { return iterator(itb->next, itb); } - iterator end() const - { - return iterator(); - } + iterator end() const { return iterator(); } l_iterator begin(std::size_t bucket_index) const { @@ -2142,8 +2135,7 @@ namespace boost { return; } - BOOST_ASSERT( - buckets_.bucket_count() == src.buckets_.bucket_count()); + BOOST_ASSERT(buckets_.bucket_count() == src.buckets_.bucket_count()); this->reserve(src.size_); for (iterator pos = src.begin(); pos != src.end(); ++pos) { @@ -2154,8 +2146,7 @@ namespace boost { const_key_type& k = this->get_key(b.node_); std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); buckets_.insert_node(itb, b.release()); ++size_; } @@ -2201,7 +2192,9 @@ namespace boost { template void assign(table const& x, UniqueType is_unique) { - typedef typename boost::allocator_propagate_on_container_copy_assignment::type pocca; + typedef + typename boost::allocator_propagate_on_container_copy_assignment< + node_allocator_type>::type pocca; if (this != &x) { assign(x, is_unique, @@ -2211,7 +2204,7 @@ namespace boost { } template - void assign(table const &x, UniqueType is_unique, false_type) + void assign(table const& x, UniqueType is_unique, false_type) { // Strong exception safety. this->construct_spare_functions(x.current_functions()); @@ -2234,15 +2227,12 @@ namespace boost { } template - 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()); assign(x, is_unique, false_type()); - } - else - { + } else { bucket_array_type new_buckets(x.size_, x.node_alloc()); this->construct_spare_functions(x.current_functions()); this->switch_functions(); @@ -2258,8 +2248,7 @@ namespace boost { reserve(x.size_); // Finally copy the elements. - if (x.size_) - { + if (x.size_) { copy_buckets(x, is_unique); } } @@ -2347,8 +2336,7 @@ namespace boost { return extractor::extract(n->value()); } - template - std::size_t hash(Key const& k) const + template std::size_t hash(Key const& k) const { return this->hash_function()(k); } @@ -2356,8 +2344,7 @@ namespace boost { // Find Node template - node_pointer find_node_impl( - Key const& x, bucket_iterator itb) const + node_pointer find_node_impl(Key const& x, bucket_iterator itb) const { node_pointer p = node_pointer(); if (itb != buckets_.end()) { @@ -2375,12 +2362,10 @@ namespace boost { template node_pointer find_node(Key const& k) const { std::size_t const key_hash = this->hash(k); - return find_node_impl( - k, buckets_.at(buckets_.position(key_hash))); + return find_node_impl(k, buckets_.at(buckets_.position(key_hash))); } - node_pointer find_node( - const_key_type& k, bucket_iterator itb) const + node_pointer find_node(const_key_type& k, bucket_iterator itb) const { return find_node_impl(k, itb); } @@ -2414,7 +2399,7 @@ namespace boost { if (size_ > 0) { key_equal pred = this->key_eq(); 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()))) { return pp; } @@ -2508,8 +2493,7 @@ namespace boost { const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS) { std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer pos = this->find_node_impl(k, itb); if (pos) { @@ -2546,8 +2530,7 @@ namespace boost { } std::size_t const key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer p = this->find_node_impl(k, itb); if (p) { @@ -2575,8 +2558,7 @@ namespace boost { const_key_type& k = this->get_key(b.node_); std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer pos = this->find_node_impl(k, itb); if (pos) { @@ -2599,8 +2581,7 @@ namespace boost { emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k) { std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer pos = this->find_node_impl(k, itb); @@ -2643,8 +2624,7 @@ namespace boost { BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS) { std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); 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) { std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer p = this->find_node_impl(k, itb); if (p) { @@ -2723,8 +2702,7 @@ namespace boost { const_key_type& k = this->get_key(np.ptr_); std::size_t const key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer p = this->find_node_impl(k, itb); if (p) { @@ -2762,8 +2740,7 @@ namespace boost { } std::size_t const key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer p = this->find_node_impl(k, itb); if (p) { return iterator(p, itb); @@ -2786,8 +2763,8 @@ namespace boost { void merge_unique(boost::unordered::detail::table& other) { typedef boost::unordered::detail::table other_table; - BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::value)); BOOST_ASSERT(this->node_alloc() == other.node_alloc()); if (other.size_ == 0) { @@ -2801,8 +2778,7 @@ namespace boost { const_key_type& key = other.get_key(pos.p); std::size_t const key_hash = this->hash(key); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); if (this->find_node_impl(key, itb)) { ++pos; @@ -2887,10 +2863,11 @@ namespace boost { return 1; } - iterator erase_node(c_iterator pos) { + iterator erase_node(c_iterator pos) + { c_iterator next = pos; ++next; - + bucket_iterator itb = pos.itb; node_pointer* pp = boost::addressof(itb->next); while (*pp != pos.p) { @@ -2927,7 +2904,6 @@ namespace boost { this->delete_node(p); --size_; - bool const at_end = !(*pp); bool const is_empty_bucket = !itb->next; @@ -3022,8 +2998,8 @@ namespace boost { return true; } - static bool group_equals_equiv(iterator n1, iterator end1, - iterator n2, iterator end2) + static bool group_equals_equiv( + iterator n1, iterator end1, iterator n2, iterator end2) { for (;;) { if (*n1 != *n2) @@ -3071,8 +3047,7 @@ namespace boost { return true; } - static bool find_equiv( - iterator n, iterator last, value_type const& v) + static bool find_equiv(iterator n, iterator last, value_type const& v) { for (; n != last; ++n) if (*n == v) @@ -3097,8 +3072,7 @@ namespace boost { node_tmp a(n, this->node_alloc()); const_key_type& k = this->get_key(a.node_); std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer hint = this->find_node_impl(k, itb); if (size_ + 1 > max_load_) { @@ -3166,8 +3140,7 @@ namespace boost { const_key_type& k = this->get_key(np.ptr_); std::size_t key_hash = this->hash(k); - bucket_iterator itb = - buckets_.at(buckets_.position(key_hash)); + bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); node_pointer hint = this->find_node_impl(k, itb); buckets_.insert_node_hint(itb, np.ptr_, hint); @@ -3634,9 +3607,9 @@ namespace boost { return (size - c.size()); } - } - } -} + } // namespace detail + } // namespace unordered +} // namespace boost #undef BOOST_UNORDERED_EMPLACE_TEMPLATE #undef BOOST_UNORDERED_EMPLACE_ARGS diff --git a/include/boost/unordered/detail/narrow_cast.hpp b/include/boost/unordered/detail/narrow_cast.hpp index da89f67f..8b1d8e1c 100644 --- a/include/boost/unordered/detail/narrow_cast.hpp +++ b/include/boost/unordered/detail/narrow_cast.hpp @@ -19,7 +19,7 @@ namespace unordered{ namespace detail{ template -BOOST_CONSTEXPR To narrow_cast(From x) BOOST_NOEXCEPT +BOOST_CONSTEXPR To narrow_cast(From x) noexcept { BOOST_STATIC_ASSERT(boost::is_integral::value); BOOST_STATIC_ASSERT(boost::is_integral::value); diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 2a707c49..d2bbbeb6 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -14,15 +14,15 @@ #pragma once #endif +#include #include -#include +#include +#include + #include #include #include #include -#include -#include -#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include @@ -99,10 +99,10 @@ namespace boost { unordered_map(unordered_map const&); -#if defined(BOOST_UNORDERED_USE_MOVE) || \ +#if defined(BOOST_UNORDERED_USE_MOVE) || \ !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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()) { // The move is done in table_ @@ -148,9 +148,9 @@ namespace boost { // Destructor - ~unordered_map() BOOST_NOEXCEPT; + ~unordered_map() noexcept; -// Assign + // Assign #if defined(BOOST_UNORDERED_USE_MOVE) 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) - BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + noexcept(value_allocator_traits::is_always_equal::value&& boost::is_nothrow_move_assignable::value&& boost::is_nothrow_move_assignable

::value) { @@ -176,7 +176,7 @@ namespace boost { #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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::value&& boost::is_nothrow_move_assignable

::value) { @@ -190,43 +190,43 @@ namespace boost { unordered_map& operator=(std::initializer_list); #endif - allocator_type get_allocator() const BOOST_NOEXCEPT + allocator_type get_allocator() const noexcept { 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()); } - 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()); } - const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } + const_iterator cend() const noexcept { return const_iterator(); } // size and capacity - BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept { 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) @@ -397,7 +397,8 @@ namespace boost { template typename boost::enable_if< boost::is_constructible, - std::pair >::type insert(BOOST_RV_REF(P2) obj) + std::pair >::type + insert(BOOST_RV_REF(P2) obj) { return this->emplace(boost::forward(obj)); } @@ -647,18 +648,18 @@ namespace boost { iterator try_emplace( const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0) { - return table_.try_emplace_hint_unique( - hint, k, boost::unordered::detail::create_emplace_args( - boost::forward(a0))); + return table_.try_emplace_hint_unique(hint, k, + boost::unordered::detail::create_emplace_args( + boost::forward(a0))); } template iterator try_emplace(const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) { - return table_.try_emplace_hint_unique( - hint, k, boost::unordered::detail::create_emplace_args( - boost::forward(a0), boost::forward(a1))); + return table_.try_emplace_hint_unique(hint, k, + boost::unordered::detail::create_emplace_args( + boost::forward(a0), boost::forward(a1))); } template @@ -676,9 +677,9 @@ namespace boost { iterator try_emplace( const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) { - return table_.try_emplace_hint_unique( - hint, boost::move(k), boost::unordered::detail::create_emplace_args( - boost::forward(a0))); + return table_.try_emplace_hint_unique(hint, boost::move(k), + boost::unordered::detail::create_emplace_args( + boost::forward(a0))); } template @@ -761,9 +762,9 @@ namespace boost { iterator try_emplace(const_iterator hint, key_type const& k, \ BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \ { \ - return table_.try_emplace_hint_unique( \ - hint, k, boost::unordered::detail::create_emplace_args( \ - BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \ + return table_.try_emplace_hint_unique(hint, k, \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \ } \ \ template \ @@ -860,10 +861,10 @@ namespace boost { void erase_return_void(const_iterator it) { erase(it); } 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::value&& boost::is_nothrow_swappable

::value); - void clear() BOOST_NOEXCEPT { table_.clear_impl(); } + void clear() noexcept { table_.clear_impl(); } template void merge(boost::unordered_map& source); @@ -993,12 +994,9 @@ namespace boost { // bucket interface - size_type bucket_count() const BOOST_NOEXCEPT - { - return table_.bucket_count(); - } + size_type bucket_count() const noexcept { return table_.bucket_count(); } - size_type max_bucket_count() const BOOST_NOEXCEPT + size_type max_bucket_count() const noexcept { return table_.max_bucket_count(); } @@ -1018,10 +1016,7 @@ namespace boost { return table_.hash_to_bucket(table_.hash(boost::forward(k))); } - local_iterator begin(size_type n) - { - return table_.begin(n); - } + local_iterator begin(size_type n) { return table_.begin(n); } const_local_iterator begin(size_type n) const { @@ -1046,9 +1041,9 @@ namespace boost { // hash policy - float load_factor() const BOOST_NOEXCEPT; - float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } - void max_load_factor(float) BOOST_NOEXCEPT; + float load_factor() const noexcept; + float max_load_factor() const noexcept { return table_.mlf_; } + void max_load_factor(float) noexcept; void rehash(size_type); void reserve(size_type); @@ -1062,7 +1057,7 @@ namespace boost { template void serialize( - Archive & ar,unordered_map& m,unsigned int version) + Archive& ar, unordered_map& m, unsigned int version) { detail::serialize_fca_container(ar, m, version); } @@ -1213,7 +1208,7 @@ namespace boost { #if defined(BOOST_UNORDERED_USE_MOVE) || \ !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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()) { // The move is done in table_ @@ -1262,9 +1257,9 @@ namespace boost { // Destructor - ~unordered_multimap() BOOST_NOEXCEPT; + ~unordered_multimap() noexcept; -// Assign + // Assign #if defined(BOOST_UNORDERED_USE_MOVE) 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) - BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + noexcept(value_allocator_traits::is_always_equal::value&& boost::is_nothrow_move_assignable::value&& boost::is_nothrow_move_assignable

::value) { @@ -1290,7 +1285,7 @@ namespace boost { #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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::value&& boost::is_nothrow_move_assignable

::value) { @@ -1304,43 +1299,43 @@ namespace boost { unordered_multimap& operator=(std::initializer_list); #endif - allocator_type get_allocator() const BOOST_NOEXCEPT + allocator_type get_allocator() const noexcept { return table_.node_alloc(); } // 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()); } - 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()); } - const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } + const_iterator cend() const noexcept { return const_iterator(); } // size and capacity - BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept { 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) @@ -1504,8 +1499,8 @@ namespace boost { template typename boost::enable_if< - boost::is_constructible, - iterator>::type insert(BOOST_RV_REF(P2) obj) + boost::is_constructible, iterator>::type + insert(BOOST_RV_REF(P2) obj) { return this->emplace(boost::forward(obj)); } @@ -1522,8 +1517,7 @@ namespace boost { template typename boost::enable_if< - boost::is_constructible, - iterator>::type + boost::is_constructible, iterator>::type insert(const_iterator hint, BOOST_RV_REF(P2) obj) { return this->emplace_hint(hint, boost::forward(obj)); @@ -1597,10 +1591,10 @@ namespace boost { void erase_return_void(const_iterator it) { erase(it); } 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::value&& boost::is_nothrow_swappable

::value); - void clear() BOOST_NOEXCEPT { table_.clear_impl(); } + void clear() noexcept { table_.clear_impl(); } template void merge(boost::unordered_multimap& source); @@ -1702,12 +1696,9 @@ namespace boost { // bucket interface - size_type bucket_count() const BOOST_NOEXCEPT - { - return table_.bucket_count(); - } + size_type bucket_count() const noexcept { return table_.bucket_count(); } - size_type max_bucket_count() const BOOST_NOEXCEPT + size_type max_bucket_count() const noexcept { return table_.max_bucket_count(); } @@ -1756,9 +1747,9 @@ namespace boost { // hash policy - float load_factor() const BOOST_NOEXCEPT; - float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } - void max_load_factor(float) BOOST_NOEXCEPT; + float load_factor() const noexcept; + float max_load_factor() const noexcept { return table_.mlf_; } + void max_load_factor(float) noexcept; void rehash(size_type); void reserve(size_type); @@ -1772,7 +1763,7 @@ namespace boost { template void serialize( - Archive & ar,unordered_multimap& m,unsigned int version) + Archive& ar, unordered_multimap& m, unsigned int version) { detail::serialize_fca_container(ar, m, version); } @@ -2023,7 +2014,7 @@ namespace boost { #endif template - unordered_map::~unordered_map() BOOST_NOEXCEPT + unordered_map::~unordered_map() noexcept { } @@ -2043,7 +2034,7 @@ namespace boost { // size and capacity template - std::size_t unordered_map::max_size() const BOOST_NOEXCEPT + std::size_t unordered_map::max_size() const noexcept { using namespace std; @@ -2106,7 +2097,7 @@ namespace boost { template void unordered_map::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::value&& boost::is_nothrow_swappable

::value) { @@ -2236,14 +2227,14 @@ namespace boost { template typename unordered_map::mapped_type& - unordered_map::operator[](const key_type& k) + unordered_map::operator[](const key_type& k) { return table_.try_emplace_unique(k).first->second; } template typename unordered_map::mapped_type& - unordered_map::operator[](BOOST_RV_REF(key_type) k) + unordered_map::operator[](BOOST_RV_REF(key_type) k) { return table_.try_emplace_unique(boost::move(k)).first->second; } @@ -2335,7 +2326,7 @@ namespace boost { // hash policy template - float unordered_map::load_factor() const BOOST_NOEXCEPT + float unordered_map::load_factor() const noexcept { if (table_.size_ == 0) { return 0.0f; @@ -2347,7 +2338,7 @@ namespace boost { } template - void unordered_map::max_load_factor(float m) BOOST_NOEXCEPT + void unordered_map::max_load_factor(float m) noexcept { table_.max_load_factor(m); } @@ -2391,9 +2382,8 @@ namespace boost { } template - inline void swap( - unordered_map& m1, unordered_map& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))) + inline void swap(unordered_map& m1, + unordered_map& m2) noexcept(noexcept(m1.swap(m2))) { #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) struct dummy @@ -2572,15 +2562,16 @@ namespace boost { #endif template - unordered_multimap::~unordered_multimap() BOOST_NOEXCEPT + unordered_multimap::~unordered_multimap() noexcept { } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) template - unordered_multimap& unordered_multimap:: - operator=(std::initializer_list list) + unordered_multimap& + unordered_multimap::operator=( + std::initializer_list list) { this->clear(); this->insert(list.begin(), list.end()); @@ -2592,8 +2583,7 @@ namespace boost { // size and capacity template - std::size_t - unordered_multimap::max_size() const BOOST_NOEXCEPT + std::size_t unordered_multimap::max_size() const noexcept { using namespace std; @@ -2655,7 +2645,7 @@ namespace boost { template void unordered_multimap::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::value&& boost::is_nothrow_swappable

::value) { @@ -2795,7 +2785,7 @@ namespace boost { // hash policy template - float unordered_multimap::load_factor() const BOOST_NOEXCEPT + float unordered_multimap::load_factor() const noexcept { if (table_.size_ == 0) { return 0.0f; @@ -2807,8 +2797,7 @@ namespace boost { } template - void unordered_multimap::max_load_factor( - float m) BOOST_NOEXCEPT + void unordered_multimap::max_load_factor(float m) noexcept { table_.max_load_factor(m); } @@ -2853,8 +2842,7 @@ namespace boost { template inline void swap(unordered_multimap& m1, - unordered_multimap& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))) + unordered_multimap& m2) noexcept(noexcept(m1.swap(m2))) { #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) struct dummy @@ -2906,7 +2894,7 @@ namespace boost { } public: - BOOST_CONSTEXPR node_handle_map() BOOST_NOEXCEPT : ptr_(), alloc_() {} + BOOST_CONSTEXPR node_handle_map() noexcept : ptr_(), alloc_() {} ~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_), alloc_(boost::move(n.alloc_)) { @@ -2960,17 +2948,17 @@ namespace boost { 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; } - void swap(node_handle_map& n) BOOST_NOEXCEPT_IF( - boost::allocator_propagate_on_container_swap< - value_allocator>::type::value || - boost::allocator_is_always_equal::type::value) + void swap(node_handle_map& n) + noexcept(boost::allocator_propagate_on_container_swap< + value_allocator>::type::value || + boost::allocator_is_always_equal::type::value) { BOOST_ASSERT(!alloc_.has_value() || !n.alloc_.has_value() || @@ -2988,7 +2976,7 @@ namespace boost { template void swap(node_handle_map& x, node_handle_map& y) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(x.swap(y))) + noexcept(noexcept(x.swap(y))) { x.swap(y); } @@ -3009,10 +2997,10 @@ namespace boost { insert_return_type_map() : position(), inserted(false), node() {} - insert_return_type_map(BOOST_RV_REF(insert_return_type_map) - x) BOOST_NOEXCEPT : position(x.position), - inserted(x.inserted), - node(boost::move(x.node)) + insert_return_type_map(BOOST_RV_REF(insert_return_type_map) x) noexcept + : position(x.position), + inserted(x.inserted), + node(boost::move(x.node)) { } diff --git a/include/boost/unordered/unordered_map_fwd.hpp b/include/boost/unordered/unordered_map_fwd.hpp index 46be934a..729932ba 100644 --- a/include/boost/unordered/unordered_map_fwd.hpp +++ b/include/boost/unordered/unordered_map_fwd.hpp @@ -1,6 +1,6 @@ // 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 // 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!=( unordered_map const&, unordered_map const&); template - inline void swap( - unordered_map& m1, unordered_map& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))); + inline void swap(unordered_map& m1, + unordered_map& m2) noexcept(noexcept(m1.swap(m2))); template typename unordered_map::size_type erase_if( @@ -51,8 +50,7 @@ namespace boost { unordered_multimap const&); template inline void swap(unordered_multimap& m1, - unordered_multimap& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))); + unordered_multimap& m2) noexcept(noexcept(m1.swap(m2))); template typename unordered_multimap::size_type erase_if( @@ -60,13 +58,13 @@ namespace boost { template class node_handle_map; template struct insert_return_type_map; - } + } // namespace unordered + using boost::unordered::swap; using boost::unordered::unordered_map; using boost::unordered::unordered_multimap; - using boost::unordered::swap; using boost::unordered::operator==; using boost::unordered::operator!=; -} +} // namespace boost #endif diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 49bcf1ea..9a28a865 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -15,12 +15,13 @@ #endif #include +#include +#include +#include + #include #include #include -#include -#include -#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include @@ -99,7 +100,7 @@ namespace boost { #if defined(BOOST_UNORDERED_USE_MOVE) || \ !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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()) { // The move is done in table_ @@ -145,9 +146,9 @@ namespace boost { // Destructor - ~unordered_set() BOOST_NOEXCEPT; + ~unordered_set() noexcept; -// Assign + // Assign #if defined(BOOST_UNORDERED_USE_MOVE) 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) - BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + noexcept(value_allocator_traits::is_always_equal::value&& boost::is_nothrow_move_assignable::value&& boost::is_nothrow_move_assignable

::value) { @@ -173,7 +174,7 @@ namespace boost { #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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::value&& boost::is_nothrow_move_assignable

::value) { @@ -187,43 +188,43 @@ namespace boost { unordered_set& operator=(std::initializer_list); #endif - allocator_type get_allocator() const BOOST_NOEXCEPT + allocator_type get_allocator() const noexcept { return table_.node_alloc(); } // 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()); } - 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()); } - const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } + const_iterator cend() const noexcept { return const_iterator(); } // size and capacity - BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept { 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) @@ -488,10 +489,10 @@ namespace boost { void erase_return_void(const_iterator it) { erase(it); } 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::value&& boost::is_nothrow_swappable

::value); - void clear() BOOST_NOEXCEPT { table_.clear_impl(); } + void clear() noexcept { table_.clear_impl(); } template void merge(boost::unordered_set& source); @@ -573,12 +574,9 @@ namespace boost { // bucket interface - size_type bucket_count() const BOOST_NOEXCEPT - { - return table_.bucket_count(); - } + size_type bucket_count() const noexcept { return table_.bucket_count(); } - size_type max_bucket_count() const BOOST_NOEXCEPT + size_type max_bucket_count() const noexcept { return table_.max_bucket_count(); } @@ -627,9 +625,9 @@ namespace boost { // hash policy - float load_factor() const BOOST_NOEXCEPT; - float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } - void max_load_factor(float) BOOST_NOEXCEPT; + float load_factor() const noexcept; + float max_load_factor() const noexcept { return table_.mlf_; } + void max_load_factor(float) noexcept; void rehash(size_type); void reserve(size_type); @@ -643,7 +641,7 @@ namespace boost { template void serialize( - Archive & ar,unordered_set& c,unsigned int version) + Archive& ar, unordered_set& c, unsigned int version) { detail::serialize_fca_container(ar, c, version); } @@ -782,7 +780,7 @@ namespace boost { #if defined(BOOST_UNORDERED_USE_MOVE) || \ !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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()) { // The move is done in table_ @@ -831,9 +829,9 @@ namespace boost { // Destructor - ~unordered_multiset() BOOST_NOEXCEPT; + ~unordered_multiset() noexcept; -// Assign + // Assign #if defined(BOOST_UNORDERED_USE_MOVE) 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) - BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + noexcept(value_allocator_traits::is_always_equal::value&& boost::is_nothrow_move_assignable::value&& boost::is_nothrow_move_assignable

::value) { @@ -859,7 +857,7 @@ namespace boost { #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 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::value&& boost::is_nothrow_move_assignable

::value) { @@ -873,43 +871,43 @@ namespace boost { unordered_multiset& operator=(std::initializer_list); #endif - allocator_type get_allocator() const BOOST_NOEXCEPT + allocator_type get_allocator() const noexcept { return table_.node_alloc(); } // 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()); } - 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()); } - const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } + const_iterator cend() const noexcept { return const_iterator(); } // size and capacity - BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept { 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) @@ -1148,10 +1146,10 @@ namespace boost { void erase_return_void(const_iterator it) { erase(it); } 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::value&& boost::is_nothrow_swappable

::value); - void clear() BOOST_NOEXCEPT { table_.clear_impl(); } + void clear() noexcept { table_.clear_impl(); } template void merge(boost::unordered_multiset& source); @@ -1229,12 +1227,9 @@ namespace boost { // bucket interface - size_type bucket_count() const BOOST_NOEXCEPT - { - return table_.bucket_count(); - } + size_type bucket_count() const noexcept { return table_.bucket_count(); } - size_type max_bucket_count() const BOOST_NOEXCEPT + size_type max_bucket_count() const noexcept { return table_.max_bucket_count(); } @@ -1283,9 +1278,9 @@ namespace boost { // hash policy - float load_factor() const BOOST_NOEXCEPT; - float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } - void max_load_factor(float) BOOST_NOEXCEPT; + float load_factor() const noexcept; + float max_load_factor() const noexcept { return table_.mlf_; } + void max_load_factor(float) noexcept; void rehash(size_type); void reserve(size_type); @@ -1299,7 +1294,7 @@ namespace boost { template void serialize( - Archive & ar,unordered_multiset& c,unsigned int version) + Archive& ar, unordered_multiset& c, unsigned int version) { detail::serialize_fca_container(ar, c, version); } @@ -1540,7 +1535,7 @@ namespace boost { #endif template - unordered_set::~unordered_set() BOOST_NOEXCEPT + unordered_set::~unordered_set() noexcept { } @@ -1560,7 +1555,7 @@ namespace boost { // size and capacity template - std::size_t unordered_set::max_size() const BOOST_NOEXCEPT + std::size_t unordered_set::max_size() const noexcept { using namespace std; @@ -1615,7 +1610,7 @@ namespace boost { template void unordered_set::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::value&& boost::is_nothrow_swappable

::value) { @@ -1723,7 +1718,7 @@ namespace boost { // hash policy template - float unordered_set::load_factor() const BOOST_NOEXCEPT + float unordered_set::load_factor() const noexcept { if (table_.size_ == 0) { return 0.0f; @@ -1735,7 +1730,7 @@ namespace boost { } template - void unordered_set::max_load_factor(float m) BOOST_NOEXCEPT + void unordered_set::max_load_factor(float m) noexcept { table_.max_load_factor(m); } @@ -1779,9 +1774,8 @@ namespace boost { } template - inline void swap( - unordered_set& m1, unordered_set& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))) + inline void swap(unordered_set& m1, + unordered_set& m2) noexcept(noexcept(m1.swap(m2))) { #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) struct dummy @@ -1959,7 +1953,7 @@ namespace boost { #endif template - unordered_multiset::~unordered_multiset() BOOST_NOEXCEPT + unordered_multiset::~unordered_multiset() noexcept { } @@ -1979,7 +1973,7 @@ namespace boost { // size and capacity template - std::size_t unordered_multiset::max_size() const BOOST_NOEXCEPT + std::size_t unordered_multiset::max_size() const noexcept { using namespace std; @@ -2033,7 +2027,7 @@ namespace boost { template void unordered_multiset::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::value&& boost::is_nothrow_swappable

::value) { @@ -2146,7 +2140,7 @@ namespace boost { // hash policy template - float unordered_multiset::load_factor() const BOOST_NOEXCEPT + float unordered_multiset::load_factor() const noexcept { if (table_.size_ == 0) { return 0.0f; @@ -2158,7 +2152,7 @@ namespace boost { } template - void unordered_multiset::max_load_factor(float m) BOOST_NOEXCEPT + void unordered_multiset::max_load_factor(float m) noexcept { table_.max_load_factor(m); } @@ -2202,9 +2196,8 @@ namespace boost { } template - inline void swap( - unordered_multiset& m1, unordered_multiset& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))) + inline void swap(unordered_multiset& m1, + unordered_multiset& m2) noexcept(noexcept(m1.swap(m2))) { #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) struct dummy @@ -2258,10 +2251,7 @@ namespace boost { } public: - BOOST_CONSTEXPR node_handle_set() BOOST_NOEXCEPT : ptr_(), - has_alloc_(false) - { - } + BOOST_CONSTEXPR node_handle_set() noexcept : ptr_(), has_alloc_(false) {} ~node_handle_set() { @@ -2272,9 +2262,9 @@ namespace boost { } } - node_handle_set(BOOST_RV_REF(node_handle_set) n) BOOST_NOEXCEPT - : ptr_(n.ptr_), - alloc_(boost::move(n.alloc_)) + node_handle_set(BOOST_RV_REF(node_handle_set) n) noexcept + : ptr_(n.ptr_), + alloc_(boost::move(n.alloc_)) { n.ptr_ = node_pointer(); } @@ -2310,16 +2300,16 @@ namespace boost { 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; } - void swap(node_handle_set& n) BOOST_NOEXCEPT_IF( - value_allocator_traits::propagate_on_container_swap::value || - value_allocator_traits::is_always_equal::value) + void swap(node_handle_set& n) + noexcept(value_allocator_traits::propagate_on_container_swap::value || + value_allocator_traits::is_always_equal::value) { BOOST_ASSERT( !alloc_.has_value() || !n.alloc_.has_value() || @@ -2335,7 +2325,7 @@ namespace boost { template void swap(node_handle_set& x, node_handle_set& y) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(x.swap(y))) + noexcept(noexcept(x.swap(y))) { x.swap(y); } @@ -2356,10 +2346,10 @@ namespace boost { insert_return_type_set() : position(), inserted(false), node() {} - insert_return_type_set(BOOST_RV_REF(insert_return_type_set) - x) BOOST_NOEXCEPT : position(x.position), - inserted(x.inserted), - node(boost::move(x.node)) + insert_return_type_set(BOOST_RV_REF(insert_return_type_set) x) noexcept + : position(x.position), + inserted(x.inserted), + node(boost::move(x.node)) { } @@ -2373,8 +2363,8 @@ namespace boost { }; template - void swap( - insert_return_type_set& x, insert_return_type_set& y) + void swap(insert_return_type_set& x, + insert_return_type_set& y) { boost::core::invoke_swap(x.node, y.node); boost::core::invoke_swap(x.inserted, y.inserted); diff --git a/include/boost/unordered/unordered_set_fwd.hpp b/include/boost/unordered/unordered_set_fwd.hpp index 3722d25a..aeb06c15 100644 --- a/include/boost/unordered/unordered_set_fwd.hpp +++ b/include/boost/unordered/unordered_set_fwd.hpp @@ -29,9 +29,8 @@ namespace boost { inline bool operator!=( unordered_set const&, unordered_set const&); template - inline void swap( - unordered_set& m1, unordered_set& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))); + inline void swap(unordered_set& m1, + unordered_set& m2) noexcept(noexcept(m1.swap(m2))); template typename unordered_set::size_type erase_if( @@ -48,9 +47,8 @@ namespace boost { inline bool operator!=(unordered_multiset const&, unordered_multiset const&); template - inline void swap( - unordered_multiset& m1, unordered_multiset& m2) - BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))); + inline void swap(unordered_multiset& m1, + unordered_multiset& m2) noexcept(noexcept(m1.swap(m2))); template typename unordered_multiset::size_type erase_if( @@ -58,13 +56,13 @@ namespace boost { template class node_handle_set; template struct insert_return_type_set; - } + } // namespace unordered - using boost::unordered::unordered_set; - using boost::unordered::unordered_multiset; using boost::unordered::swap; + using boost::unordered::unordered_multiset; + using boost::unordered::unordered_set; using boost::unordered::operator==; using boost::unordered::operator!=; -} +} // namespace boost #endif diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index b2c00a54..e55b0438 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -46,7 +46,7 @@ template int implicit_construct() #endif #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 #define TEST_NOEXCEPT_EXPR(x) #endif diff --git a/test/unordered/noexcept_tests.cpp b/test/unordered/noexcept_tests.cpp index dd0c8110..10fea076 100644 --- a/test/unordered/noexcept_tests.cpp +++ b/test/unordered/noexcept_tests.cpp @@ -62,8 +62,7 @@ namespace noexcept_tests { typedef boost::hash base; public: - hash_nothrow(BOOST_RV_REF(hash_nothrow)) - BOOST_NOEXCEPT_IF(nothrow_move_construct) + hash_nothrow(BOOST_RV_REF(hash_nothrow)) noexcept(nothrow_move_construct) { if (!nothrow_move_construct) { test_throw("Move Constructor"); @@ -78,7 +77,7 @@ namespace noexcept_tests { return *this; } hash_nothrow& operator=(BOOST_RV_REF(hash_nothrow)) - BOOST_NOEXCEPT_IF(nothrow_move_assign) + noexcept(nothrow_move_assign) { if (!nothrow_move_assign) { test_throw("Move Assign"); @@ -90,8 +89,7 @@ namespace noexcept_tests { test_throw("Operator"); return static_cast(*this)(x); } - friend void swap(hash_nothrow&, hash_nothrow&) - BOOST_NOEXCEPT_IF(nothrow_swap) + friend void swap(hash_nothrow&, hash_nothrow&) noexcept(nothrow_swap) { if (!nothrow_swap) { test_throw("Swap"); @@ -113,7 +111,7 @@ namespace noexcept_tests { public: equal_to_nothrow(BOOST_RV_REF(equal_to_nothrow)) - BOOST_NOEXCEPT_IF(nothrow_move_construct) + noexcept(nothrow_move_construct) { if (!nothrow_move_construct) { test_throw("Move Constructor"); @@ -128,7 +126,7 @@ namespace noexcept_tests { return *this; } equal_to_nothrow& operator=(BOOST_RV_REF(equal_to_nothrow)) - BOOST_NOEXCEPT_IF(nothrow_move_assign) + noexcept(nothrow_move_assign) { if (!nothrow_move_assign) { test_throw("Move Assign"); @@ -141,7 +139,7 @@ namespace noexcept_tests { return x == y; } friend void swap(equal_to_nothrow&, equal_to_nothrow&) - BOOST_NOEXCEPT_IF(nothrow_swap) + noexcept(nothrow_swap) { if (!nothrow_swap) { test_throw("Swap"); diff --git a/test/unordered/reserve_tests.cpp b/test/unordered/reserve_tests.cpp index 00823cf9..29b4b5b0 100644 --- a/test/unordered/reserve_tests.cpp +++ b/test/unordered/reserve_tests.cpp @@ -24,7 +24,7 @@ template struct A A() : i(++count) {} - template A(const A& a) BOOST_NOEXCEPT : i(a.i) {} + template A(const A& a) noexcept : i(a.i) {} T* allocate(std::size_t n) { @@ -33,7 +33,7 @@ template struct A 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); std::free(p);