Path: blob/main/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.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___COMPARE_THREE_WAY_COMPARABLE_H9#define _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H1011#include <__compare/common_comparison_category.h>12#include <__compare/ordering.h>13#include <__concepts/common_reference_with.h>14#include <__concepts/equality_comparable.h>15#include <__concepts/same_as.h>16#include <__concepts/totally_ordered.h>17#include <__config>18#include <__type_traits/common_reference.h>19#include <__type_traits/make_const_lvalue_ref.h>2021#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)22# pragma GCC system_header23#endif2425_LIBCPP_BEGIN_NAMESPACE_STD2627#if _LIBCPP_STD_VER >= 202829template <class _Tp, class _Cat>30concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;3132template <class _Tp, class _Cat = partial_ordering>33concept three_way_comparable =34__weakly_equality_comparable_with<_Tp, _Tp> && __partially_ordered_with<_Tp, _Tp> &&35requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) {36{ __a <=> __b } -> __compares_as<_Cat>;37};3839template <class _Tp, class _Up, class _Cat = partial_ordering>40concept three_way_comparable_with =41three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> &&42common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&43three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&44__weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&45requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {46{ __t <=> __u } -> __compares_as<_Cat>;47{ __u <=> __t } -> __compares_as<_Cat>;48};4950#endif // _LIBCPP_STD_VER >= 205152_LIBCPP_END_NAMESPACE_STD5354#endif // _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H555657