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_EQUALITY_COMPARABLE_H
0010 #define _LIBCPP___CONCEPTS_EQUALITY_COMPARABLE_H
0011 
0012 #include <__concepts/boolean_testable.h>
0013 #include <__concepts/common_reference_with.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.equalitycomparable]
0027 
0028 template <class _Tp, class _Up>
0029 concept __weakly_equality_comparable_with =
0030     requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
0031       { __t == __u } -> __boolean_testable;
0032       { __t != __u } -> __boolean_testable;
0033       { __u == __t } -> __boolean_testable;
0034       { __u != __t } -> __boolean_testable;
0035     };
0036 
0037 template <class _Tp>
0038 concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
0039 
0040 // clang-format off
0041 template <class _Tp, class _Up>
0042 concept equality_comparable_with =
0043     equality_comparable<_Tp> && equality_comparable<_Up> &&
0044     common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
0045     equality_comparable<
0046         common_reference_t<
0047             __make_const_lvalue_ref<_Tp>,
0048             __make_const_lvalue_ref<_Up>>> &&
0049     __weakly_equality_comparable_with<_Tp, _Up>;
0050 // clang-format on
0051 
0052 #endif // _LIBCPP_STD_VER >= 20
0053 
0054 _LIBCPP_END_NAMESPACE_STD
0055 
0056 #endif // _LIBCPP___CONCEPTS_EQUALITY_COMPARABLE_H