Namespaces
Variants

std:: strict_weak_order

From cppreference.net
td> (C++20 起)
定义于头文件 <concepts>
template < class R, class T, class U >
concept strict_weak_order = std:: relation < R, T, U > ;

概念 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 概念 strict_weak_order [concept.strictweakorder]
  • C++20 标准 (ISO/IEC 14882:2020):
  • 18.7.7 概念 strict_weak_order [concept.strictweakorder]

另请参阅