@@ -1009,9 +1009,22 @@ public:
1009
1009
__insert_node_at (__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
1010
1010
1011
1011
template <class _Key >
1012
- _LIBCPP_HIDE_FROM_ABI iterator find (const _Key& __v);
1012
+ _LIBCPP_HIDE_FROM_ABI iterator find (const _Key& __key) {
1013
+ __end_node_pointer __parent;
1014
+ __node_base_pointer __match = __find_equal (__parent, __key);
1015
+ if (__match == nullptr )
1016
+ return end ();
1017
+ return iterator (static_cast <__node_pointer>(__match));
1018
+ }
1019
+
1013
1020
template <class _Key >
1014
- _LIBCPP_HIDE_FROM_ABI const_iterator find (const _Key& __v) const ;
1021
+ _LIBCPP_HIDE_FROM_ABI const_iterator find (const _Key& __key) const {
1022
+ __end_node_pointer __parent;
1023
+ __node_base_pointer __match = __find_equal (__parent, __key);
1024
+ if (__match == nullptr )
1025
+ return end ();
1026
+ return const_iterator (static_cast <__node_pointer>(__match));
1027
+ }
1015
1028
1016
1029
template <class _Key >
1017
1030
_LIBCPP_HIDE_FROM_ABI size_type __count_unique (const _Key& __k) const ;
@@ -2031,25 +2044,6 @@ __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
2031
2044
return __r;
2032
2045
}
2033
2046
2034
- template <class _Tp , class _Compare , class _Allocator >
2035
- template <class _Key >
2036
- typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) {
2037
- iterator __p = __lower_bound (__v, __root (), __end_node ());
2038
- if (__p != end () && !value_comp ()(__v, *__p))
2039
- return __p;
2040
- return end ();
2041
- }
2042
-
2043
- template <class _Tp , class _Compare , class _Allocator >
2044
- template <class _Key >
2045
- typename __tree<_Tp, _Compare, _Allocator>::const_iterator
2046
- __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const {
2047
- const_iterator __p = __lower_bound (__v, __root (), __end_node ());
2048
- if (__p != end () && !value_comp ()(__v, *__p))
2049
- return __p;
2050
- return end ();
2051
- }
2052
-
2053
2047
template <class _Tp , class _Compare , class _Allocator >
2054
2048
template <class _Key >
2055
2049
typename __tree<_Tp, _Compare, _Allocator>::size_type
0 commit comments