名稱空間
變體
操作

std::strict_weak_order

來自 cppreference.com
定義於標頭檔案 <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 滿足以下條件,則它是一個嚴格弱序:

  • 它是非自反的:對於所有 xr(x, x)false
  • 它是傳遞的:對於所有 abc,如果 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 確定的等價類上誘導嚴格全序。

[編輯] 注意

relationstrict_weak_order 之間的區別純粹是語義上的。

[編輯] 參考

  • C++23 標準 (ISO/IEC 14882:2024)
  • 18.7.7 Concept strict_weak_order [concept.strictweakorder]
  • C++20 標準 (ISO/IEC 14882:2020)
  • 18.7.7 Concept strict_weak_order [concept.strictweakorder]

[編輯] 另見