Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:09

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___ALGORITHM_RANGES_FIND_END_H
0010 #define _LIBCPP___ALGORITHM_RANGES_FIND_END_H
0011 
0012 #include <__algorithm/find_end.h>
0013 #include <__algorithm/iterator_operations.h>
0014 #include <__algorithm/ranges_iterator_concept.h>
0015 #include <__config>
0016 #include <__functional/identity.h>
0017 #include <__functional/ranges_operations.h>
0018 #include <__iterator/concepts.h>
0019 #include <__iterator/indirectly_comparable.h>
0020 #include <__iterator/iterator_traits.h>
0021 #include <__ranges/access.h>
0022 #include <__ranges/concepts.h>
0023 #include <__ranges/subrange.h>
0024 #include <__utility/pair.h>
0025 
0026 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0027 #  pragma GCC system_header
0028 #endif
0029 
0030 _LIBCPP_PUSH_MACROS
0031 #include <__undef_macros>
0032 
0033 #if _LIBCPP_STD_VER >= 20
0034 
0035 _LIBCPP_BEGIN_NAMESPACE_STD
0036 
0037 namespace ranges {
0038 struct __find_end {
0039   template <forward_iterator _Iter1,
0040             sentinel_for<_Iter1> _Sent1,
0041             forward_iterator _Iter2,
0042             sentinel_for<_Iter2> _Sent2,
0043             class _Pred  = ranges::equal_to,
0044             class _Proj1 = identity,
0045             class _Proj2 = identity>
0046     requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
0047   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter1> operator()(
0048       _Iter1 __first1,
0049       _Sent1 __last1,
0050       _Iter2 __first2,
0051       _Sent2 __last2,
0052       _Pred __pred   = {},
0053       _Proj1 __proj1 = {},
0054       _Proj2 __proj2 = {}) const {
0055     auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
0056         __first1,
0057         __last1,
0058         __first2,
0059         __last2,
0060         __pred,
0061         __proj1,
0062         __proj2,
0063         __iterator_concept<_Iter1>(),
0064         __iterator_concept<_Iter2>());
0065     return {__ret.first, __ret.second};
0066   }
0067 
0068   template <forward_range _Range1,
0069             forward_range _Range2,
0070             class _Pred  = ranges::equal_to,
0071             class _Proj1 = identity,
0072             class _Proj2 = identity>
0073     requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
0074   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range1> operator()(
0075       _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
0076     auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
0077         ranges::begin(__range1),
0078         ranges::end(__range1),
0079         ranges::begin(__range2),
0080         ranges::end(__range2),
0081         __pred,
0082         __proj1,
0083         __proj2,
0084         __iterator_concept<iterator_t<_Range1>>(),
0085         __iterator_concept<iterator_t<_Range2>>());
0086     return {__ret.first, __ret.second};
0087   }
0088 };
0089 
0090 inline namespace __cpo {
0091 inline constexpr auto find_end = __find_end{};
0092 } // namespace __cpo
0093 } // namespace ranges
0094 
0095 _LIBCPP_END_NAMESPACE_STD
0096 
0097 #endif // _LIBCPP_STD_VER >= 20
0098 
0099 _LIBCPP_POP_MACROS
0100 
0101 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H