std::strict_weak_order
來自 cppreference.com
< cpp | 概念 (concepts)
定義於標頭檔案 <concepts> |
||
template< class R, class T, class U > concept strict_weak_order = std::relation<R, T, U>; |
(C++20 起) | |
概念 strict_weak_order<R, T, U>
指定 relation
R
對其引數施加嚴格弱序。
目錄 |
[編輯] 語義要求
若關係 r 滿足以下條件,則它是一個嚴格弱序:
- 它是非自反的:對於所有 x,r(x, x) 為 false;
- 它是傳遞的:對於所有 a、b 和 c,如果 r(a, b) 和 r(b, c) 都為 true,則 r(a, c) 為 true;
- 令 e(a, b) 為 !r(a, b) && !r(b, a),則 e 是傳遞的:e(a, b) && e(b, c) 蘊含 e(a, c)。
在這些條件下,可以證明 e 是一個等價關係,並且 r 在由 e 確定的等價類上誘導嚴格全序。
[編輯] 注意
relation
和 strict_weak_order
之間的區別純粹是語義上的。
[編輯] 參考
- C++23 標準 (ISO/IEC 14882:2024)
- 18.7.7 Concept
strict_weak_order
[concept.strictweakorder]
- 18.7.7 Concept
- C++20 標準 (ISO/IEC 14882:2020)
- 18.7.7 Concept
strict_weak_order
[concept.strictweakorder]
- 18.7.7 Concept