File indexing completed on 2026-05-03 08:13:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
0010 #define _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
0011
0012 #include <__algorithm/lexicographical_compare.h>
0013 #include <__algorithm/unwrap_range.h>
0014 #include <__config>
0015 #include <__functional/identity.h>
0016 #include <__functional/invoke.h>
0017 #include <__functional/ranges_operations.h>
0018 #include <__iterator/concepts.h>
0019 #include <__iterator/projected.h>
0020 #include <__ranges/access.h>
0021 #include <__ranges/concepts.h>
0022 #include <__utility/move.h>
0023
0024 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0025 # pragma GCC system_header
0026 #endif
0027
0028 _LIBCPP_PUSH_MACROS
0029 #include <__undef_macros>
0030
0031 #if _LIBCPP_STD_VER >= 20
0032
0033 _LIBCPP_BEGIN_NAMESPACE_STD
0034
0035 namespace ranges {
0036 struct __lexicographical_compare {
0037 template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Comp>
0038 static _LIBCPP_HIDE_FROM_ABI constexpr bool __lexicographical_compare_unwrap(
0039 _Iter1 __first1,
0040 _Sent1 __last1,
0041 _Iter2 __first2,
0042 _Sent2 __last2,
0043 _Comp& __comp,
0044 _Proj1& __proj1,
0045 _Proj2& __proj2) {
0046 auto [__first1_un, __last1_un] = std::__unwrap_range(std::move(__first1), std::move(__last1));
0047 auto [__first2_un, __last2_un] = std::__unwrap_range(std::move(__first2), std::move(__last2));
0048 return std::__lexicographical_compare(
0049 std::move(__first1_un),
0050 std::move(__last1_un),
0051 std::move(__first2_un),
0052 std::move(__last2_un),
0053 __comp,
0054 __proj1,
0055 __proj2);
0056 }
0057
0058 template <input_iterator _Iter1,
0059 sentinel_for<_Iter1> _Sent1,
0060 input_iterator _Iter2,
0061 sentinel_for<_Iter2> _Sent2,
0062 class _Proj1 = identity,
0063 class _Proj2 = identity,
0064 indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
0065 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
0066 _Iter1 __first1,
0067 _Sent1 __last1,
0068 _Iter2 __first2,
0069 _Sent2 __last2,
0070 _Comp __comp = {},
0071 _Proj1 __proj1 = {},
0072 _Proj2 __proj2 = {}) const {
0073 return __lexicographical_compare_unwrap(
0074 std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __comp, __proj1, __proj2);
0075 }
0076
0077 template <input_range _Range1,
0078 input_range _Range2,
0079 class _Proj1 = identity,
0080 class _Proj2 = identity,
0081 indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
0082 _Comp = ranges::less>
0083 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
0084 _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
0085 return __lexicographical_compare_unwrap(
0086 ranges::begin(__range1),
0087 ranges::end(__range1),
0088 ranges::begin(__range2),
0089 ranges::end(__range2),
0090 __comp,
0091 __proj1,
0092 __proj2);
0093 }
0094 };
0095
0096 inline namespace __cpo {
0097 inline constexpr auto lexicographical_compare = __lexicographical_compare{};
0098 }
0099 }
0100
0101 _LIBCPP_END_NAMESPACE_STD
0102
0103 #endif
0104
0105 _LIBCPP_POP_MACROS
0106
0107 #endif