Path: blob/main/contrib/llvm-project/libcxx/include/__concepts/totally_ordered.h
35262 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H9#define _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H1011#include <__concepts/boolean_testable.h>12#include <__concepts/equality_comparable.h>13#include <__config>14#include <__type_traits/common_reference.h>15#include <__type_traits/make_const_lvalue_ref.h>1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif2021_LIBCPP_BEGIN_NAMESPACE_STD2223#if _LIBCPP_STD_VER >= 202425// [concept.totallyordered]2627template <class _Tp, class _Up>28concept __partially_ordered_with = requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {29{ __t < __u } -> __boolean_testable;30{ __t > __u } -> __boolean_testable;31{ __t <= __u } -> __boolean_testable;32{ __t >= __u } -> __boolean_testable;33{ __u < __t } -> __boolean_testable;34{ __u > __t } -> __boolean_testable;35{ __u <= __t } -> __boolean_testable;36{ __u >= __t } -> __boolean_testable;37};3839template <class _Tp>40concept totally_ordered = equality_comparable<_Tp> && __partially_ordered_with<_Tp, _Tp>;4142// clang-format off43template <class _Tp, class _Up>44concept totally_ordered_with =45totally_ordered<_Tp> && totally_ordered<_Up> &&46equality_comparable_with<_Tp, _Up> &&47totally_ordered<48common_reference_t<49__make_const_lvalue_ref<_Tp>,50__make_const_lvalue_ref<_Up>>> &&51__partially_ordered_with<_Tp, _Up>;52// clang-format on5354#endif // _LIBCPP_STD_VER >= 205556_LIBCPP_END_NAMESPACE_STD5758#endif // _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H596061