File indexing completed on 2026-05-03 08:13:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___ALGORITHM_RANGES_STARTS_WITH_H
0010 #define _LIBCPP___ALGORITHM_RANGES_STARTS_WITH_H
0011
0012 #include <__algorithm/in_in_result.h>
0013 #include <__algorithm/ranges_mismatch.h>
0014 #include <__config>
0015 #include <__functional/identity.h>
0016 #include <__functional/ranges_operations.h>
0017 #include <__iterator/concepts.h>
0018 #include <__iterator/indirectly_comparable.h>
0019 #include <__ranges/access.h>
0020 #include <__ranges/concepts.h>
0021 #include <__utility/move.h>
0022
0023 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0024 # pragma GCC system_header
0025 #endif
0026
0027 _LIBCPP_PUSH_MACROS
0028 #include <__undef_macros>
0029
0030 #if _LIBCPP_STD_VER >= 23
0031
0032 _LIBCPP_BEGIN_NAMESPACE_STD
0033
0034 namespace ranges {
0035 struct __starts_with {
0036 template <input_iterator _Iter1,
0037 sentinel_for<_Iter1> _Sent1,
0038 input_iterator _Iter2,
0039 sentinel_for<_Iter2> _Sent2,
0040 class _Pred = ranges::equal_to,
0041 class _Proj1 = identity,
0042 class _Proj2 = identity>
0043 requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
0044 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool operator()(
0045 _Iter1 __first1,
0046 _Sent1 __last1,
0047 _Iter2 __first2,
0048 _Sent2 __last2,
0049 _Pred __pred = {},
0050 _Proj1 __proj1 = {},
0051 _Proj2 __proj2 = {}) {
0052 return __mismatch::__go(
0053 std::move(__first1),
0054 std::move(__last1),
0055 std::move(__first2),
0056 std::move(__last2),
0057 __pred,
0058 __proj1,
0059 __proj2)
0060 .in2 == __last2;
0061 }
0062
0063 template <input_range _Range1,
0064 input_range _Range2,
0065 class _Pred = ranges::equal_to,
0066 class _Proj1 = identity,
0067 class _Proj2 = identity>
0068 requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
0069 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool
0070 operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) {
0071 return __mismatch::__go(
0072 ranges::begin(__range1),
0073 ranges::end(__range1),
0074 ranges::begin(__range2),
0075 ranges::end(__range2),
0076 __pred,
0077 __proj1,
0078 __proj2)
0079 .in2 == ranges::end(__range2);
0080 }
0081 };
0082 inline namespace __cpo {
0083 inline constexpr auto starts_with = __starts_with{};
0084 }
0085 }
0086
0087 _LIBCPP_END_NAMESPACE_STD
0088
0089 #endif
0090
0091 _LIBCPP_POP_MACROS
0092
0093 #endif