Back to home page

EIC code displayed by LXR

 
 

    


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

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___CONCEPTS_TOTALLY_ORDERED_H
0010 #define _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H
0011 
0012 #include <__concepts/boolean_testable.h>
0013 #include <__concepts/equality_comparable.h>
0014 #include <__config>
0015 #include <__type_traits/common_reference.h>
0016 #include <__type_traits/make_const_lvalue_ref.h>
0017 
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 #  pragma GCC system_header
0020 #endif
0021 
0022 _LIBCPP_BEGIN_NAMESPACE_STD
0023 
0024 #if _LIBCPP_STD_VER >= 20
0025 
0026 // [concept.totallyordered]
0027 
0028 template <class _Tp, class _Up>
0029 concept __partially_ordered_with = requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
0030   { __t < __u } -> __boolean_testable;
0031   { __t > __u } -> __boolean_testable;
0032   { __t <= __u } -> __boolean_testable;
0033   { __t >= __u } -> __boolean_testable;
0034   { __u < __t } -> __boolean_testable;
0035   { __u > __t } -> __boolean_testable;
0036   { __u <= __t } -> __boolean_testable;
0037   { __u >= __t } -> __boolean_testable;
0038 };
0039 
0040 template <class _Tp>
0041 concept totally_ordered = equality_comparable<_Tp> && __partially_ordered_with<_Tp, _Tp>;
0042 
0043 // clang-format off
0044 template <class _Tp, class _Up>
0045 concept totally_ordered_with =
0046     totally_ordered<_Tp> && totally_ordered<_Up> &&
0047     equality_comparable_with<_Tp, _Up> &&
0048     totally_ordered<
0049         common_reference_t<
0050             __make_const_lvalue_ref<_Tp>,
0051             __make_const_lvalue_ref<_Up>>> &&
0052     __partially_ordered_with<_Tp, _Up>;
0053 // clang-format on
0054 
0055 #endif // _LIBCPP_STD_VER >= 20
0056 
0057 _LIBCPP_END_NAMESPACE_STD
0058 
0059 #endif // _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H