On Mon, 31 Mar 2025 at 15:53, Tomasz Kaminski <tkami...@redhat.com> wrote:
>
>
>
> On Mon, Mar 31, 2025 at 3:03 PM Jonathan Wakely <jwak...@redhat.com> wrote:
>>
>> The boolean-testable requirements don't require the type to be copyable,
>> so we need to convert to bool before it might need to be copied.
>>
>> libstdc++-v3/ChangeLog:
>>
>>         PR libstdc++/119545
>>         * include/std/tuple (operator==): Convert comparison results to
>>         bool.
>>         * testsuite/20_util/tuple/comparison_operators/119545.cc: New
>>         test.
>> ---
>>
>> Tested x86_64-linux.
>
> LGTM.
>>
>>
>> For the recent r15-7897-ge6e7b477bbdbfb change to fix a similar problem
>> I used an explicit return type on the lambda, because that was what the
>> LWG issue said to do. In this case an explicit return type would also
>> work, but I used an explicit conversion to bool on each element of the
>> pack expansion instead.
>
> boolean-testable requirements allows you to do that: a && b on 
> boolean-testable a, bis
> required to have the same behavior bool(a) && bool(b), so all good.
>
>>
>> That matches what is done elsewhere in <tuple>
>> for the tuple-like equality comparison, so I preferred to be locally
>> consistent.
>
> We also are no longer triggering lookup for opeartor&& on boolean-testable,
> which is required to find nothing, but still will be performed. So I think 
> converting
> to bool before applying &&/|| on boolean-testable is good idea.

Yes, that did occur to me. But I decided that all sane comparisons
return bool anyway so the benefit was mostly theoretical :-)

Thanks for the review.

Reply via email to