added pull to open-addressing containers (#309)

* added pull to open-addressing containers

* added pull_tests.cpp

* guarded pull against exceptions in mid init_type construction
This commit is contained in:
joaquintides
2025-04-14 21:47:30 +02:00
committed by GitHub
parent 2907fe8c98
commit 3dde65b2ef
13 changed files with 173 additions and 6 deletions
+9 -1
View File
@@ -1,6 +1,6 @@
/* Fast open-addressing hash table.
*
* Copyright 2022-2024 Joaquin M Lopez Munoz.
* Copyright 2022-2025 Joaquin M Lopez Munoz.
* Copyright 2023 Christian Mazakas.
* Copyright 2024 Braden Ganetsky.
* Distributed under the Boost Software License, Version 1.0.
@@ -495,6 +495,14 @@ public:
else return 0;
}
BOOST_FORCEINLINE init_type pull(const_iterator pos)
{
BOOST_ASSERT(pos!=end());
erase_on_exit e{*this,pos};
(void)e;
return type_policy::move(type_policy::value_from(*pos.p()));
}
void swap(table& x)
noexcept(noexcept(std::declval<super&>().swap(std::declval<super&>())))
{