Date: Sun, 29 Nov 2026 08:56:23 +0300
[[[[Below]]]]...
вс, 29 нояб. 2026 г. в 03:53, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]>:
> On Saturday, 28 November 2026 16:19:07 Pacific Standard Time Aleksandr
> Povaliaev via Std-Proposals wrote:
> > 4) having two comparison operators for the same class is a potential
> source
> > of errors and misunderstanding (this is what I am talking about);
>
> Agreed that it can be a potential source of errors, if misused.
>
> I even agree with you that clean design should use the class's own
> operator==
> and should not compare a portion of the object. But my point of view is
> just
> that: my opinion. Others have other reasons.
>
> It's also a flexibility that is very much wanted.
>
> I can readily see motivations where you'd want to deploy your comparator
> and
> hasher for a portion of the object: for example, when you're given a
> large(r)
> object you must store anyway, but whose uniqueness in the set in question
> is a
> subset of the object's identity. And as a specific example, think of
> struct
> sockaddr_in6: in most cases, port number and address are sufficient
> condition
> for uniqueness and you do not need to compare the sin6_flowinfo field.
>
[[[[Alex]]]] You should introduce another structure which contains only
these two fields:
struct short_sockaddr_in6 {
in_port_tsin6_port;
struct in6_addr sin6_addr; };
otherwise you just storring trash. And such design will reflect the real
state of things: "you are not storing sockaddr_in6 objects, you're storing
only these two fields information and all the other fields information will
be lost all together with all the other objects having the same two fields
value - you'll get only 1 object inserted to std::unordered_set instead of
10 or 100".
And again when using std::unordered_map, there is a very erroneous case
"(key1, value2") which I described before.
> Then there's the case where you must provide those because the type in
> question didn't provide them at the time you began using them. Now maybe
> it
> does - should your code suddenly begin producing warnings?
>
> Restricting the flexibility of other users and uses needs to be for a very
> good
> reason. And you have not provided one.
>
> > So, there is still some room for improvement. And after all, I've not
> > proposed any changes to 'unordered_set' and 'unordered_map' interfaces.
> > Where did you see it? I just wrote about invariants, assertions and
> > warnings from the very beginning.
>
> The fact that you're posting to the Standard *Proposals* mailing list. We
> expect you to either have a proposal or an idea for one, which we could
> then
> help shape, or discuss someone else's proposal.
>
> Maybe you should have tried the Standard Discussion mailing list, or one
> of
> many other C++ discussion forums such as the Cpplang Slack.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel Data Center - Platform & Sys. Eng.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
вс, 29 нояб. 2026 г. в 03:53, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]>:
> On Saturday, 28 November 2026 16:19:07 Pacific Standard Time Aleksandr
> Povaliaev via Std-Proposals wrote:
> > 4) having two comparison operators for the same class is a potential
> source
> > of errors and misunderstanding (this is what I am talking about);
>
> Agreed that it can be a potential source of errors, if misused.
>
> I even agree with you that clean design should use the class's own
> operator==
> and should not compare a portion of the object. But my point of view is
> just
> that: my opinion. Others have other reasons.
>
> It's also a flexibility that is very much wanted.
>
> I can readily see motivations where you'd want to deploy your comparator
> and
> hasher for a portion of the object: for example, when you're given a
> large(r)
> object you must store anyway, but whose uniqueness in the set in question
> is a
> subset of the object's identity. And as a specific example, think of
> struct
> sockaddr_in6: in most cases, port number and address are sufficient
> condition
> for uniqueness and you do not need to compare the sin6_flowinfo field.
>
[[[[Alex]]]] You should introduce another structure which contains only
these two fields:
struct short_sockaddr_in6 {
in_port_tsin6_port;
struct in6_addr sin6_addr; };
otherwise you just storring trash. And such design will reflect the real
state of things: "you are not storing sockaddr_in6 objects, you're storing
only these two fields information and all the other fields information will
be lost all together with all the other objects having the same two fields
value - you'll get only 1 object inserted to std::unordered_set instead of
10 or 100".
And again when using std::unordered_map, there is a very erroneous case
"(key1, value2") which I described before.
> Then there's the case where you must provide those because the type in
> question didn't provide them at the time you began using them. Now maybe
> it
> does - should your code suddenly begin producing warnings?
>
> Restricting the flexibility of other users and uses needs to be for a very
> good
> reason. And you have not provided one.
>
> > So, there is still some room for improvement. And after all, I've not
> > proposed any changes to 'unordered_set' and 'unordered_map' interfaces.
> > Where did you see it? I just wrote about invariants, assertions and
> > warnings from the very beginning.
>
> The fact that you're posting to the Standard *Proposals* mailing list. We
> expect you to either have a proposal or an idea for one, which we could
> then
> help shape, or discuss someone else's proposal.
>
> Maybe you should have tried the Standard Discussion mailing list, or one
> of
> many other C++ discussion forums such as the Cpplang Slack.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel Data Center - Platform & Sys. Eng.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2026-11-29 05:56:41
