[libc++] Implement ranges::adjacent_find

Reviewed By: Mordante, var-const, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D126610

NOKEYCHECK=True
GitOrigin-RevId: 916e9052ba955cbef994491026f7fbcced14b9ba
diff --git a/include/algorithm b/include/algorithm
index 80788ed..6f542be 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -391,6 +391,16 @@
                             Pred pred = {},
                             Proj1 proj1 = {}, Proj2 proj2 = {});                            // since C++20
 
+  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
+           indirect_binary_predicate<projected<I, Proj>,
+                                     projected<I, Proj>> Pred = ranges::equal_to>
+    constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});     // since C+20
+
+  template<forward_range R, class Proj = identity,
+           indirect_binary_predicate<projected<iterator_t<R>, Proj>,
+                                     projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
+    constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});  // since C++20
+
 }
 
     constexpr bool     // constexpr in C++20
@@ -1107,6 +1117,7 @@
 #include <__algorithm/pop_heap.h>
 #include <__algorithm/prev_permutation.h>
 #include <__algorithm/push_heap.h>
+#include <__algorithm/ranges_adjacent_find.h>
 #include <__algorithm/ranges_all_of.h>
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>