C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Q: invariant for unordered_set and unordered_map "hash" and "comp" argument

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 29 Nov 2026 11:21:31 -0800
On Sunday, 29 November 2026 10:18:28 Pacific Standard Time Aleksandr Povaliaev
wrote:
> If someone is making a mistake doing that, it's their problem. I agree that
> it would be useful to detect the error and tell the user. Can you write an
> algorithm that detects when it's wrong? This feels more like a job for an
> AI assistant, not the compiler.
>
> [[[[[Alex]]]]] You see!!! You do understand that such a design is not
> perfect and for some reason you keep advocating it.

Yes, it's not perfect. But it's still the best we have. Your idea (not a
proposal) is *not* better. I also challenged you to come up with an algorithm
implementable in the compiler such that it could correctly flag erroneous
usages. You have not yet provided one.

Your personal preference is not a factor in a C++ decision, however much I may
agree with it or not.

Maybe in a green field scenario we should have designed differently. We are not
in a green field scenario, so any change proposed must deal with the existing
codebase. You are not dealing with it, you are dismissing it out of hand. That
means your idea is instead dismissed out of hand. If you want to be taken
seriously, write a serious proposal that deals with the installed base which
has legitimate uses for the feature you want to deprecate (and that's exactly
what a compiler warning will be understood as).

> You started with the
> wrong decision of not using default comparison operator == and at the next
> step you just run into a "not so good" unordered_set structure, which "just
> stores unnecessary fields". And after some more steps, the design will be
> even worther. This is what I want to inform the developper by compile-time
> warnings, since there is no any option to introduce a run-time assertion.

Who said it was the wrong decision? You are making an assumption here not
based on facts.

I'm going to stop responding now. You are not taking this discussion as
seriously as you should. Your opinions may be used to inform your preferences,
but they are not binding on everyone else.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-11-29 19:21:35