File indexing completed on 2026-05-03 08:13:18
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H
0010 #define _LIBCPP___CXX03___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H
0011
0012 #include <__cxx03/__algorithm/comp.h>
0013 #include <__cxx03/__algorithm/comp_ref_type.h>
0014 #include <__cxx03/__config>
0015 #include <__cxx03/__iterator/iterator_traits.h>
0016
0017 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0018 # pragma GCC system_header
0019 #endif
0020
0021 _LIBCPP_BEGIN_NAMESPACE_STD
0022
0023 template <class _Compare, class _InputIterator1, class _InputIterator2>
0024 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __lexicographical_compare(
0025 _InputIterator1 __first1,
0026 _InputIterator1 __last1,
0027 _InputIterator2 __first2,
0028 _InputIterator2 __last2,
0029 _Compare __comp) {
0030 for (; __first2 != __last2; ++__first1, (void)++__first2) {
0031 if (__first1 == __last1 || __comp(*__first1, *__first2))
0032 return true;
0033 if (__comp(*__first2, *__first1))
0034 return false;
0035 }
0036 return false;
0037 }
0038
0039 template <class _InputIterator1, class _InputIterator2, class _Compare>
0040 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare(
0041 _InputIterator1 __first1,
0042 _InputIterator1 __last1,
0043 _InputIterator2 __first2,
0044 _InputIterator2 __last2,
0045 _Compare __comp) {
0046 return std::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
0047 }
0048
0049 template <class _InputIterator1, class _InputIterator2>
0050 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare(
0051 _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
0052 return std::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>());
0053 }
0054
0055 _LIBCPP_END_NAMESPACE_STD
0056
0057 #endif