From c3786357a6497da7f777332a347bbe83e393f1ea Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 5 Sep 2023 15:31:18 -0700 Subject: [PATCH] Update noexcept specification to accomodate for throwing `arrays::new_` --- include/boost/unordered/concurrent_flat_map.hpp | 11 ++++++----- .../boost/unordered/detail/foa/concurrent_table.hpp | 3 ++- include/boost/unordered/detail/foa/core.hpp | 13 +++++++++---- include/boost/unordered/unordered_flat_map.hpp | 11 ++++------- include/boost/unordered/unordered_flat_set.hpp | 11 ++++------- include/boost/unordered/unordered_node_map.hpp | 11 ++++------- include/boost/unordered/unordered_node_set.hpp | 11 ++++------- 7 files changed, 33 insertions(+), 38 deletions(-) diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index e04f84b6..c95a3015 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -92,7 +92,10 @@ namespace boost { using type_policy = detail::foa::flat_map_types; - detail::foa::concurrent_table table_; + using table_type = + detail::foa::concurrent_table; + + table_type table_; template bool friend operator==(concurrent_flat_map const& lhs, @@ -248,10 +251,8 @@ namespace boost { return *this; } - concurrent_flat_map& operator=(concurrent_flat_map&& rhs) - noexcept(boost::allocator_is_always_equal::type::value || - boost::allocator_propagate_on_container_move_assignment< - Allocator>::type::value) + concurrent_flat_map& operator=(concurrent_flat_map&& rhs) noexcept( + noexcept(std::declval() = std::declval())) { table_ = std::move(rhs.table_); return *this; diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index 2ba80519..0b8e9b22 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -493,7 +493,8 @@ public: return *this; } - concurrent_table& operator=(concurrent_table&& x) + concurrent_table& operator=(concurrent_table&& x)noexcept( + noexcept(std::declval() = std::declval())) { auto lck=exclusive_access(*this,x); super::operator=(std::move(x)); diff --git a/include/boost/unordered/detail/foa/core.hpp b/include/boost/unordered/detail/foa/core.hpp index 09dab69b..731a1c9b 100644 --- a/include/boost/unordered/detail/foa/core.hpp +++ b/include/boost/unordered/detail/foa/core.hpp @@ -1267,6 +1267,10 @@ public: using element_type=typename type_policy::element_type; using arrays_type=Arrays; using size_ctrl_type=SizeControl; + static constexpr auto uses_fancy_pointers=!std::is_same< + typename alloc_traits::pointer, + typename alloc_traits::value_type* + >::value; using key_type=typename type_policy::key_type; using init_type=typename type_policy::init_type; @@ -1308,7 +1312,8 @@ public: noexcept( std::is_nothrow_move_constructible::value&& std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value): + std::is_nothrow_move_constructible::value&& + !uses_fancy_pointers): table_core{ std::move(x.h()),std::move(x.pred()),std::move(x.al()), x.arrays,x.size_ctrl} @@ -1352,7 +1357,7 @@ public: delete_arrays(arrays); } - void empty_initialize()noexcept + void empty_initialize()noexcept(!uses_fancy_pointers) { arrays=new_arrays(0); size_ctrl.ml=initial_max_load(); @@ -1404,8 +1409,8 @@ public: table_core& operator=(table_core&& x) noexcept( - alloc_traits::propagate_on_container_move_assignment::value|| - alloc_traits::is_always_equal::value) + (alloc_traits::propagate_on_container_move_assignment::value|| + alloc_traits::is_always_equal::value)&&!uses_fancy_pointers) { BOOST_UNORDERED_STATIC_ASSERT_HASH_PRED(Hash, Pred) diff --git a/include/boost/unordered/unordered_flat_map.hpp b/include/boost/unordered/unordered_flat_map.hpp index 1e829c1d..b7ea0a82 100644 --- a/include/boost/unordered/unordered_flat_map.hpp +++ b/include/boost/unordered/unordered_flat_map.hpp @@ -141,9 +141,7 @@ namespace boost { } unordered_flat_map(unordered_flat_map&& other) - noexcept(std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value) + noexcept(std::is_nothrow_move_constructible::value) : table_(std::move(other.table_)) { } @@ -697,10 +695,9 @@ namespace boost { return erase_if(map.table_, pred); } - template - void serialize( - Archive & ar, + template + void serialize(Archive& ar, unordered_flat_map& map, unsigned int version) { diff --git a/include/boost/unordered/unordered_flat_set.hpp b/include/boost/unordered/unordered_flat_set.hpp index 01cadf21..2676cafc 100644 --- a/include/boost/unordered/unordered_flat_set.hpp +++ b/include/boost/unordered/unordered_flat_set.hpp @@ -133,9 +133,7 @@ namespace boost { } unordered_flat_set(unordered_flat_set&& other) - noexcept(std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value) + noexcept(std::is_nothrow_move_constructible::value) : table_(std::move(other.table_)) { } @@ -506,10 +504,9 @@ namespace boost { return erase_if(set.table_, pred); } - template - void serialize( - Archive & ar, + template + void serialize(Archive& ar, unordered_flat_set& set, unsigned int version) { diff --git a/include/boost/unordered/unordered_node_map.hpp b/include/boost/unordered/unordered_node_map.hpp index 483139a3..0c6a4e4c 100644 --- a/include/boost/unordered/unordered_node_map.hpp +++ b/include/boost/unordered/unordered_node_map.hpp @@ -180,9 +180,7 @@ namespace boost { } unordered_node_map(unordered_node_map&& other) - noexcept(std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value) + noexcept(std::is_nothrow_move_constructible::value) : table_(std::move(other.table_)) { } @@ -790,10 +788,9 @@ namespace boost { return erase_if(map.table_, pred); } - template - void serialize( - Archive & ar, + template + void serialize(Archive& ar, unordered_node_map& map, unsigned int version) { diff --git a/include/boost/unordered/unordered_node_set.hpp b/include/boost/unordered/unordered_node_set.hpp index 04cb90a4..1dac7405 100644 --- a/include/boost/unordered/unordered_node_set.hpp +++ b/include/boost/unordered/unordered_node_set.hpp @@ -170,9 +170,7 @@ namespace boost { } unordered_node_set(unordered_node_set&& other) - noexcept(std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_constructible::value) + noexcept(std::is_nothrow_move_constructible::value) : table_(std::move(other.table_)) { } @@ -603,10 +601,9 @@ namespace boost { return erase_if(set.table_, pred); } - template - void serialize( - Archive & ar, + template + void serialize(Archive& ar, unordered_node_set& set, unsigned int version) {