std::equivalence_relation (C++20 起)
|
在标头
<concepts> 定义 |
||
|
template< class R, class T, class U >
concept equivalence_relation = std::relation<R, T, U>; |
(C++20 起) | |
概念 equivalence_relation<R, T, U> 指定 relation R 在其实参上施加一种等价关系。
语义要求
满足以下条件时,关系 r 为等价关系:
- 它为自反:对于所有
x,r(x, x)为true; - 它为对称:对于所有
a与b,当且仅当r(b, a)为true时r(a, b)为true; - 它为传递:
r(a, b) && r(b, c)蕴含r(a, c)。
注解
relation 与 equivalence_relation 间的区别是纯语义的。
引用
- C++23 标准(ISO/IEC 14882:2024):
-
- 18.7.6 Concept
equivalence_relation[concept.equiv]
- 18.7.6 Concept
- C++20 标准(ISO/IEC 14882:2020):
-
- 18.7.6 Concept
equivalence_relation[concept.equiv]
- 18.7.6 Concept