Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:07

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___VECTOR_COMPARISON_H
0010 #define _LIBCPP___VECTOR_COMPARISON_H
0011 
0012 #include <__algorithm/equal.h>
0013 #include <__algorithm/lexicographical_compare.h>
0014 #include <__algorithm/lexicographical_compare_three_way.h>
0015 #include <__compare/synth_three_way.h>
0016 #include <__config>
0017 #include <__fwd/vector.h>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 template <class _Tp, class _Allocator>
0026 _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI bool
0027 operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0028   const typename vector<_Tp, _Allocator>::size_type __sz = __x.size();
0029   return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
0030 }
0031 
0032 #if _LIBCPP_STD_VER <= 17
0033 
0034 template <class _Tp, class _Allocator>
0035 inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0036   return !(__x == __y);
0037 }
0038 
0039 template <class _Tp, class _Allocator>
0040 inline _LIBCPP_HIDE_FROM_ABI bool operator<(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0041   return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
0042 }
0043 
0044 template <class _Tp, class _Allocator>
0045 inline _LIBCPP_HIDE_FROM_ABI bool operator>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0046   return __y < __x;
0047 }
0048 
0049 template <class _Tp, class _Allocator>
0050 inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0051   return !(__x < __y);
0052 }
0053 
0054 template <class _Tp, class _Allocator>
0055 inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0056   return !(__y < __x);
0057 }
0058 
0059 #else // _LIBCPP_STD_VER <= 17
0060 
0061 template <class _Tp, class _Allocator>
0062 _LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
0063 operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
0064   return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
0065 }
0066 
0067 #endif // _LIBCPP_STD_VER <= 17
0068 
0069 _LIBCPP_END_NAMESPACE_STD
0070 
0071 #endif // _LIBCPP___VECTOR_COMPARISON_H