From a31e894411c7f0504c1fe3279d08af07f35dd1e8 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Mon, 25 Jul 2022 11:35:38 -0700 Subject: [PATCH] Update implementation to use `erase_node()` where applicable --- include/boost/unordered/unordered_map.hpp | 16 ++++------------ include/boost/unordered/unordered_set.hpp | 9 ++------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 02fe1f9f..97908fb6 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1856,18 +1856,14 @@ namespace boost { typename unordered_map::iterator unordered_map::erase(iterator position) { - const_iterator last = position; - ++last; - return table_.erase_nodes_range(position, last); + return table_.erase_node(position); } template typename unordered_map::iterator unordered_map::erase(const_iterator position) { - const_iterator last = position; - ++last; - return table_.erase_nodes_range(position, last); + return table_.erase_node(position); } template @@ -2340,9 +2336,7 @@ namespace boost { unordered_multimap::erase(iterator position) { BOOST_ASSERT(position != this->end()); - iterator next = position; - ++next; - return table_.erase_nodes_range(position, next); + return table_.erase_node(position); } template @@ -2350,9 +2344,7 @@ namespace boost { unordered_multimap::erase(const_iterator position) { BOOST_ASSERT(position != this->end()); - const_iterator next = position; - ++next; - return table_.erase_nodes_range(position, next); + return table_.erase_node(position); } template diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index d1ddc347..8721a68a 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -1457,9 +1457,7 @@ namespace boost { typename unordered_set::iterator unordered_set::erase(const_iterator position) { - const_iterator last = position; - ++last; - return table_.erase_nodes_range(position, last); + return table_.erase_node(position); } template @@ -1853,10 +1851,7 @@ namespace boost { unordered_multiset::erase(const_iterator position) { BOOST_ASSERT(position != this->end()); - iterator next = position; - ++next; - table_.erase_nodes_range(position, next); - return next; + return table_.erase_node(position); } template