Skip to content

Commit e61022d

Browse files
committed
[libc++] Optimize __tree::__erase_unique
1 parent 1f1b903 commit e61022d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libcxx/include/__tree

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,10 +2062,11 @@ template <class _Tp, class _Compare, class _Allocator>
20622062
template <class _Key>
20632063
typename __tree<_Tp, _Compare, _Allocator>::size_type
20642064
__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
2065-
iterator __i = find(__k);
2066-
if (__i == end())
2065+
__end_node_pointer __parent;
2066+
__node_base_pointer __i = __find_equal(__parent, __k);
2067+
if (__i == nullptr)
20672068
return 0;
2068-
erase(__i);
2069+
erase(iterator(static_cast<__node_pointer>(__i)));
20692070
return 1;
20702071
}
20712072

0 commit comments

Comments
 (0)