From 196ab7bb1953c42ef5fa1d4ac4a6d1eaf58953a5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 27 Aug 2023 19:44:29 +0300 Subject: [PATCH] fix erase and rebalance --- loader/include/Geode/c++stl/gnustl.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/loader/include/Geode/c++stl/gnustl.hpp b/loader/include/Geode/c++stl/gnustl.hpp index 84217820..5e9983ac 100644 --- a/loader/include/Geode/c++stl/gnustl.hpp +++ b/loader/include/Geode/c++stl/gnustl.hpp @@ -147,16 +147,15 @@ namespace gd { } } - std::pair equal_range(const K& __k) { + std::pair equal_range(K const& __k) { return std::pair(lower_bound(__k), upper_bound(__k)); } size_t erase(K const& __x) { std::pair __p = equal_range(__x); - size_t __n = 0; - distance(__p.first, __p.second, __n); + size_t __old = size(); erase(__p.first, __p.second); - return __n; + return __old - size(); } void clear() { @@ -180,7 +179,8 @@ namespace gd { void erase(iterator __pos) { _tree_node __y = static_cast<_tree_node>(_rb_rebalance_for_erase( - __pos.m_node, m_header.m_parent, m_header.m_left, m_header.m_right)); + __pos.m_node, m_header + )); delete __y; --m_nodecount; }