Back to home page

EIC code displayed by LXR

 
 

    


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

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___CXX03___ALGORITHM_RANGES_STARTS_WITH_H
0010 #define _LIBCPP___CXX03___ALGORITHM_RANGES_STARTS_WITH_H
0011 
0012 #include <__cxx03/__algorithm/in_in_result.h>
0013 #include <__cxx03/__algorithm/ranges_mismatch.h>
0014 #include <__cxx03/__config>
0015 #include <__cxx03/__functional/identity.h>
0016 #include <__cxx03/__functional/ranges_operations.h>
0017 #include <__cxx03/__iterator/concepts.h>
0018 #include <__cxx03/__iterator/indirectly_comparable.h>
0019 #include <__cxx03/__ranges/access.h>
0020 #include <__cxx03/__ranges/concepts.h>
0021 #include <__cxx03/__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 <__cxx03/__undef_macros>
0029 
0030 #if _LIBCPP_STD_VER >= 23
0031 
0032 _LIBCPP_BEGIN_NAMESPACE_STD
0033 
0034 namespace ranges {
0035 namespace __starts_with {
0036 struct __fn {
0037   template <input_iterator _Iter1,
0038             sentinel_for<_Iter1> _Sent1,
0039             input_iterator _Iter2,
0040             sentinel_for<_Iter2> _Sent2,
0041             class _Pred  = ranges::equal_to,
0042             class _Proj1 = identity,
0043             class _Proj2 = identity>
0044     requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
0045   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool operator()(
0046       _Iter1 __first1,
0047       _Sent1 __last1,
0048       _Iter2 __first2,
0049       _Sent2 __last2,
0050       _Pred __pred   = {},
0051       _Proj1 __proj1 = {},
0052       _Proj2 __proj2 = {}) {
0053     return __mismatch::__fn::__go(
0054                std::move(__first1),
0055                std::move(__last1),
0056                std::move(__first2),
0057                std::move(__last2),
0058                __pred,
0059                __proj1,
0060                __proj2)
0061                .in2 == __last2;
0062   }
0063 
0064   template <input_range _Range1,
0065             input_range _Range2,
0066             class _Pred  = ranges::equal_to,
0067             class _Proj1 = identity,
0068             class _Proj2 = identity>
0069     requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
0070   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool
0071   operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) {
0072     return __mismatch::__fn::__go(
0073                ranges::begin(__range1),
0074                ranges::end(__range1),
0075                ranges::begin(__range2),
0076                ranges::end(__range2),
0077                __pred,
0078                __proj1,
0079                __proj2)
0080                .in2 == ranges::end(__range2);
0081   }
0082 };
0083 } // namespace __starts_with
0084 inline namespace __cpo {
0085 inline constexpr auto starts_with = __starts_with::__fn{};
0086 } // namespace __cpo
0087 } // namespace ranges
0088 
0089 _LIBCPP_END_NAMESPACE_STD
0090 
0091 #endif // _LIBCPP_STD_VER >= 23
0092 
0093 _LIBCPP_POP_MACROS
0094 
0095 #endif // _LIBCPP___CXX03___ALGORITHM_RANGES_STARTS_WITH_H