C++ Logo

std-discussion

Advanced search

Re: Comparison operators

From: Vladimir Grigoriev <vlad.moscow_at_[hidden]>
Date: Mon, 19 Dec 2022 17:32:32 +0300
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?
 
Does it mean a case when two expanded lists are unequal or something else?
 
In any case a code example of such «otherwise» along with the example of a trivial comparison that follows would be useful to make the statement more clear.
 
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
 
  
>Понедельник, 19 декабря 2022, 14:33 +03:00 от Edward Catmur via Std-Discussion <std-discussion_at_[hidden]>:
>
>
>On Mon, 19 Dec 2022, 11:31 Vladimir Grigoriev via Std-Discussion, < std-discussion_at_[hidden] > wrote:
>>Can anybody translate this phrase from the C++ 20 Standard
>>
>>«Name lookups in the defaulted definition of a comparison operator function are performed from a context equivalent to its function-body.»
>>
>>to the human language?
>>
>>How can a context be equivalent to a function body? They are two different notions.
>
>A context equivalent to the context of the function body.
>
>
>
>>With best regards
>>(Vlad from Moscow)
>>You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com --
>>Std-Discussion mailing list
>>Std-Discussion_at_[hidden]
>>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>--
>Std-Discussion mailing list
>Std-Discussion_at_lists.isocpp.org
>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
 

Received on 2022-12-19 14:32:56