[libcxx-commits] [libcxx] [libc++][NFC] Remove __find_end_classic (PR #88749)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 15 08:16:06 PDT 2024


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/88749

This is identical to the public `find_end`, so there is no need for the additional internal function.


>From ae50103a3f14e87799cb8137ad83ea56d83a0ec1 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 15 Apr 2024 17:15:13 +0200
Subject: [PATCH] [libc++][NFC] Remove __find_end_classic

---
 libcxx/include/__algorithm/find_end.h | 14 ++------------
 libcxx/include/__string/char_traits.h |  2 +-
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/libcxx/include/__algorithm/find_end.h b/libcxx/include/__algorithm/find_end.h
index 4c26891666b223..1590351d8e3ee4 100644
--- a/libcxx/include/__algorithm/find_end.h
+++ b/libcxx/include/__algorithm/find_end.h
@@ -184,12 +184,12 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
 }
 
 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_end_classic(
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(
     _ForwardIterator1 __first1,
     _ForwardIterator1 __last1,
     _ForwardIterator2 __first2,
     _ForwardIterator2 __last2,
-    _BinaryPredicate& __pred) {
+    _BinaryPredicate __pred) {
   auto __proj = __identity();
   return std::__find_end_impl<_ClassicAlgPolicy>(
              __first1,
@@ -204,16 +204,6 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Fo
       .first;
 }
 
-template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(
-    _ForwardIterator1 __first1,
-    _ForwardIterator1 __last1,
-    _ForwardIterator2 __first2,
-    _ForwardIterator2 __last2,
-    _BinaryPredicate __pred) {
-  return std::__find_end_classic(__first1, __last1, __first2, __last2, __pred);
-}
-
 template <class _ForwardIterator1, class _ForwardIterator2>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index 47ed1057caaab1..f933af287493a7 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -600,7 +600,7 @@ __str_rfind(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _Si
     __pos += __n;
   else
     __pos = __sz;
-  const _CharT* __r = std::__find_end_classic(__p, __p + __pos, __s, __s + __n, _Traits::eq);
+  const _CharT* __r = std::find_end(__p, __p + __pos, __s, __s + __n, _Traits::eq);
   if (__n > 0 && __r == __p + __pos)
     return __npos;
   return static_cast<_SizeT>(__r - __p);



More information about the libcxx-commits mailing list