On Mon, Dec 19, 2022 at 8:32 AM Vladimir Grigoriev via Std-Discussion <std-discussion@lists.isocpp.org> 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.»

It would be helpful if you would point out where these phrases exist in the C++20 Standard, as it would make it easier for people to answer your questions. In this case, this is [class.eq]/3 (https://eel.is/c++draft/class.eq#3)
 
 
What does the last statement « Otherwise, V is false.»» mean?
 
Does it mean a case when two expanded lists are unequal or something else?

No, the expanded lists have to be equal - we have the same type on both sides. There are two separate things going on in this paragraph:

  1. What work is done? We compare xi == yi until the first i for which xi == yi, contextually convertible to bool, yields false.
  2. What value is returned? If no such i exists, V (the return value) is true. Otherwise, V is false.
Introducing V doesn't seem like it adds anything, if the wording said "If no such index exists, the return value is true. Otherwise, the return value is false." it'd be more direct.  

 
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)
 
 
Понедельник, 19 декабря 2022, 14:33 +03:00 от Edward Catmur via Std-Discussion <std-discussion@lists.isocpp.org>:
 
 
On Mon, 19 Dec 2022, 11:31 Vladimir Grigoriev via Std-Discussion, <std-discussion@lists.isocpp.org> 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. 
 
 
 
 
--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion