Skip to content

Commit 8400324

Browse files
authored
[libc++][NFC] Rename __find_impl to __find (llvm#90163)
For most algorithms we've just added underscores to the detail function. This changes `std::find` to match that pattern.
1 parent 9bb84ce commit 8400324

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

libcxx/include/__algorithm/find.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4343
// generic implementation
4444
template <class _Iter, class _Sent, class _Tp, class _Proj>
4545
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
46-
__find_impl(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
46+
__find(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
4747
for (; __first != __last; ++__first)
4848
if (std::__invoke(__proj, *__first) == __value)
4949
break;
@@ -57,8 +57,7 @@ template <class _Tp,
5757
__enable_if_t<__is_identity<_Proj>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
5858
sizeof(_Tp) == 1,
5959
int> = 0>
60-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp*
61-
__find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
60+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
6261
if (auto __ret = std::__constexpr_memchr(__first, __value, __last - __first))
6362
return __ret;
6463
return __last;
@@ -71,8 +70,7 @@ template <class _Tp,
7170
__enable_if_t<__is_identity<_Proj>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
7271
sizeof(_Tp) == sizeof(wchar_t) && _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t),
7372
int> = 0>
74-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp*
75-
__find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
73+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
7674
if (auto __ret = std::__constexpr_wmemchr(__first, __value, __last - __first))
7775
return __ret;
7876
return __last;
@@ -89,10 +87,10 @@ template <class _Tp,
8987
is_signed<_Tp>::value == is_signed<_Up>::value,
9088
int> = 0>
9189
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp*
92-
__find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) {
90+
__find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) {
9391
if (__value < numeric_limits<_Tp>::min() || __value > numeric_limits<_Tp>::max())
9492
return __last;
95-
return std::__find_impl(__first, __last, _Tp(__value), __proj);
93+
return std::__find(__first, __last, _Tp(__value), __proj);
9694
}
9795

9896
// __bit_iterator implementation
@@ -134,7 +132,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
134132

135133
template <class _Cp, bool _IsConst, class _Tp, class _Proj, __enable_if_t<__is_identity<_Proj>::value, int> = 0>
136134
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, _IsConst>
137-
__find_impl(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
135+
__find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
138136
if (static_cast<bool>(__value))
139137
return std::__find_bool<true>(__first, static_cast<typename _Cp::size_type>(__last - __first));
140138
return std::__find_bool<false>(__first, static_cast<typename _Cp::size_type>(__last - __first));
@@ -150,7 +148,7 @@ template <class _SegmentedIterator,
150148
class _Proj,
151149
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
152150
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator
153-
__find_impl(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value, _Proj& __proj) {
151+
__find(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value, _Proj& __proj) {
154152
return std::__find_segment_if(std::move(__first), std::move(__last), __find_segment<_Tp>(__value), __proj);
155153
}
156154

@@ -163,7 +161,7 @@ struct __find_segment {
163161
template <class _InputIterator, class _Proj>
164162
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _InputIterator
165163
operator()(_InputIterator __first, _InputIterator __last, _Proj& __proj) const {
166-
return std::__find_impl(__first, __last, __value_, __proj);
164+
return std::__find(__first, __last, __value_, __proj);
167165
}
168166
};
169167

@@ -173,7 +171,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _In
173171
find(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
174172
__identity __proj;
175173
return std::__rewrap_iter(
176-
__first, std::__find_impl(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __value, __proj));
174+
__first, std::__find(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __value, __proj));
177175
}
178176

179177
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/ranges_find.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ struct __fn {
4444
if constexpr (forward_iterator<_Iter>) {
4545
auto [__first_un, __last_un] = std::__unwrap_range(__first, std::move(__last));
4646
return std::__rewrap_range<_Sent>(
47-
std::move(__first), std::__find_impl(std::move(__first_un), std::move(__last_un), __value, __proj));
47+
std::move(__first), std::__find(std::move(__first_un), std::move(__last_un), __value, __proj));
4848
} else {
49-
return std::__find_impl(std::move(__first), std::move(__last), __value, __proj);
49+
return std::__find(std::move(__first), std::move(__last), __value, __proj);
5050
}
5151
}
5252

libcxx/include/__string/char_traits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> {
344344
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
345345
find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
346346
__identity __proj;
347-
const char_type* __match = std::__find_impl(__s, __s + __n, __a, __proj);
347+
const char_type* __match = std::__find(__s, __s + __n, __a, __proj);
348348
if (__match == __s + __n)
349349
return nullptr;
350350
return __match;
@@ -430,7 +430,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> {
430430
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
431431
find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
432432
__identity __proj;
433-
const char_type* __match = std::__find_impl(__s, __s + __n, __a, __proj);
433+
const char_type* __match = std::__find(__s, __s + __n, __a, __proj);
434434
if (__match == __s + __n)
435435
return nullptr;
436436
return __match;

0 commit comments

Comments
 (0)