5

的有效值为std::strong_orderinglessequal和。然而,看起来和是相等的(,可互换的),因为在这两种情况下,仅展示字段都等于零,并且没有其他状态可供仅展示构造函数初始化。equivalentgreaterstrong_ordering::equivalentstrong_ordering::equalvalue

strong_ordering没有任何单独 的值是有道理的equivalent,因为当排序很强时,等价的值总是相等的。但是,为 做strong_ordering::equivalent一个同义词strong_ordering::equal而不是根本不定义它有什么意义呢?

4

1 回答 1

6

This allows C::equivalent to be defined for all comparison categories C. There used to be five of them, all of which had this, now just the three.

If you need something like that, it helps to have it. And it costs nothing to provide, so... there it is.

于 2020-12-18T20:48:11.067 回答