From dbe93c765c56cb242c99a3801828f9d506fbb658 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 21 Oct 2023 12:35:59 +0200 Subject: [PATCH] asserted allocator equality on unordered_node_(map|set)::merge and updated docs --- doc/unordered/unordered_node_map.adoc | 6 ++++++ doc/unordered/unordered_node_set.adoc | 6 ++++++ include/boost/unordered/unordered_node_map.hpp | 2 ++ include/boost/unordered/unordered_node_set.hpp | 2 ++ 4 files changed, 16 insertions(+) diff --git a/doc/unordered/unordered_node_map.adoc b/doc/unordered/unordered_node_map.adoc index d746261b..14164705 100644 --- a/doc/unordered/unordered_node_map.adoc +++ b/doc/unordered/unordered_node_map.adoc @@ -1216,6 +1216,12 @@ template Transfers all the element nodes from `source` whose key is not already present in `*this`. +[horizontal] +Requires:;; `this\->get_allocator() == source.get_allocator()`. +Notes:;; Invalidates iterators to the elements transferred. +If the resulting size of `*this` is greater than its original maximum load, +invalidates all iterators associated to `*this`. + --- === Observers diff --git a/doc/unordered/unordered_node_set.adoc b/doc/unordered/unordered_node_set.adoc index cbf00444..cf5e8282 100644 --- a/doc/unordered/unordered_node_set.adoc +++ b/doc/unordered/unordered_node_set.adoc @@ -1030,6 +1030,12 @@ template Transfers all the element nodes from `source` whose key is not already present in `*this`. +[horizontal] +Requires:;; `this\->get_allocator() == source.get_allocator()`. +Notes:;; Invalidates iterators to the elements transferred. +If the resulting size of `*this` is greater than its original maximum load, +invalidates all iterators associated to `*this`. + --- === Observers diff --git a/include/boost/unordered/unordered_node_map.hpp b/include/boost/unordered/unordered_node_map.hpp index d2ea4bf8..10c72cb4 100644 --- a/include/boost/unordered/unordered_node_map.hpp +++ b/include/boost/unordered/unordered_node_map.hpp @@ -529,6 +529,7 @@ namespace boost { unordered_node_map& source) { + BOOST_ASSERT(get_allocator() == source.get_allocator()); table_.merge(source.table_); } @@ -537,6 +538,7 @@ namespace boost { unordered_node_map&& source) { + BOOST_ASSERT(get_allocator() == source.get_allocator()); table_.merge(std::move(source.table_)); } diff --git a/include/boost/unordered/unordered_node_set.hpp b/include/boost/unordered/unordered_node_set.hpp index 9012609b..14b44bed 100644 --- a/include/boost/unordered/unordered_node_set.hpp +++ b/include/boost/unordered/unordered_node_set.hpp @@ -415,12 +415,14 @@ namespace boost { template void merge(unordered_node_set& source) { + BOOST_ASSERT(get_allocator() == source.get_allocator()); table_.merge(source.table_); } template void merge(unordered_node_set&& source) { + BOOST_ASSERT(get_allocator() == source.get_allocator()); table_.merge(std::move(source.table_)); }