Date: Mon, 19 Dec 2022 16:05:06 +0100

On 2022-12-19 at 15:32, Vladimir Grigoriev via Std-Discussion wrote:

> There is another unclear phrase in the C++ 20 Standard relative to

> comparison operators.

> «3 The return value V of a defaulted == operator function with

> parameters x and y is determined by comparing corresponding elements xi

> and yi in the expanded lists of subobjects for x and y (in increasing

> index order) until the first index i where xi == yi yields a result

> value which, when contextually converted to bool, yields false. If no

> such index exists, V is true. Otherwise, V is false.»

> What does the last statement « Otherwise, V is false.»» mean?

It is the else-part of the preceding 'if', just to make sure.

When you only have "If no such index exists, V is true.", you might

possibly wonder if V can be true anyway? So the next statement

clarifies(?) that if it is not true, it must be false.

> There is another unclear phrase in the C++ 20 Standard relative to

> comparison operators.

> «3 The return value V of a defaulted == operator function with

> parameters x and y is determined by comparing corresponding elements xi

> and yi in the expanded lists of subobjects for x and y (in increasing

> index order) until the first index i where xi == yi yields a result

> value which, when contextually converted to bool, yields false. If no

> such index exists, V is true. Otherwise, V is false.»

> What does the last statement « Otherwise, V is false.»» mean?

It is the else-part of the preceding 'if', just to make sure.

When you only have "If no such index exists, V is true.", you might

possibly wonder if V can be true anyway? So the next statement

clarifies(?) that if it is not true, it must be false.

Received on 2022-12-19 15:05:13