From 5cea4e8718a1a76f8e3bcf3b2e44b82190184cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 13 Feb 2023 10:04:07 +0100 Subject: [PATCH] Fixes #236 ("flat_tree::erase_unique uses wrong iterator") --- doc/container.qbk | 1 + include/boost/container/detail/flat_tree.hpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index d7b8a1a..7b571dd 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1413,6 +1413,7 @@ use [*Boost.Container]? There are several reasons for that: * Fixed bugs/issues: * [@https://github.com/boostorg/container/issues/232 GitHub #232: ['"Fix using pmr::polymorphic_allocator in pre-main"]]. + * [@https://github.com/boostorg/container/issues/236 GitHub #236: ['"flat_tree::erase_unique uses wrong iterator"]]. [endsect] diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp index 6271974..3c20b56 100644 --- a/include/boost/container/detail/flat_tree.hpp +++ b/include/boost/container/detail/flat_tree.hpp @@ -1129,8 +1129,8 @@ class flat_tree size_type erase_unique(const key_type& k) { - iterator i = this->find(k); - size_type ret = static_cast(i != this->end()); + const_iterator i = static_cast(*this).find(k); + size_type ret = static_cast(i != this->cend()); if (ret) this->erase(i); return ret;