C++ Logo

std-proposals

Advanced search

Re: [std-proposals] DR: concepts std::strict_weak_ordering / std::equivalence_relation must be resticted by semantic requirements

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sat, 6 May 2023 23:44:01 +0300
On Sat, 6 May 2023 at 23:31, Jonathan Wakely via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
>
>
> On Sat, 6 May 2023, 15:13 Nikl Kelbon via Std-Proposals, <std-proposals_at_[hidden]> wrote:
>>
>> Now (for compiler) std::strict_weak_ordering<...> is same as std::relation<...>, and std::equivalence_relation is same as std::relation
>> This produces amgibuity:
>>
>> #include <concepts>
>> #include <functional>
>>
>> bool foo(std::strict_weak_order<int, int> auto x) { return true; }
>> bool foo(std::relation<int, int> auto x) { return false; }
>
>
>
> Why would it be useful to write this code? Is this realistic?
>
> You haven't said why this is a problem that needs to be solved.

I wouldn't try to fix this. We're talking about concepts that are
syntactically the same, but semantically different. The language
treating overloading with them as ambiguous is *good*, not a bug.

Received on 2023-05-06 20:44:14