Date: Sun, 29 Nov 2026 02:09:33 +0100
niedz., 29 lis 2026 o 01:19 Aleksandr Povaliaev <apovalyaev_at_[hidden]>
napisał(a):
>
> C++ STL:
> 1) doesn't support debugging - no any warnings or infos are available;
What warnings? what info? And besides this could be this 1% cases I said before.
> 2) is not 99% effective (the same std::unordered_set just uses linked-list based buckets which is not so efficient);
Where did I say anything about performance? stl is designed to be
useful in general case, performance never "general" as every hash
map/set you
use in your program should be a different type to have 100% cpu
performance as you can put more restrictions that make sense on only
this one spot.
stl can't do this, it needs to be useful in a variety of use cases and
this cost performance in some specific cases.
> 3) STL now is not just a library, it is a part of C++ :D (cppreference.com is more about STL then of C++) and part of boost functionality is moving to STL on a regular basis (for example, smart pointers e.t.c.);
And?
> 4) having two comparison operators for the same class is a potential source of errors and misunderstanding (this is what I am talking about);
>
write clang-tidy plugin that checks for this, no standard change
required, others in 99% cases do not need to bother with this.
> 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.
>
"room for improvement" and "not proposed any changes", one or another.
In many cases you can't make improvements to existing types without
breaking some eggs...
Even adding a warning can break someone's code if they use `-Werror`
and have false positives.
>
> вс, 29 нояб. 2026 г. в 02:44, Marcin Jaczewski <marcinjaczewski86_at_[hidden]>:
>>
>> a) Write your own hash set, std lib is for 99% use cases, if you are
>> in the last 1%, then you should do it yourself.
>> b) Write a clang-tidy plugin that detects code you do not want.
>>
>> sob., 28 lis 2026 o 21:20 Aleksandr Povaliaev via Std-Proposals
>> <std-proposals_at_[hidden]> napisał(a):
>> >
>> > First, this is a potential source of errors. If a Key can be logically split into independent entities, then a redesign is in the order. Or you can use tuple<SubKey1, SubKey2, ... SubKeyN>.
>> >
>> > Second, this is an ineffective way of storing Key in cache-friendly unordered_set structure (not so friendly :D but more friendly then, let's say, std::set).
>> >
>> > Third, when updating a particular element in unordered_set structure, you may get an unwanted (Key1, Value2) combinations: for example, there is a (Key1, Value1) pair in the unordered_set structure already, and you're going to update it with (Key2, Value2) pair. You will find a Key1 == Key2 by comparing only part of it, and then update Value1 -> Value2. So, again this is a potential source of errors.
>> >
>> > сб, 28 нояб. 2026 г. в 22:34, Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]>:
>> >>
>> >> On 28 Nov 2026 21:14, Aleksandr Povaliaev via Std-Proposals wrote:
>> >> > I don't like the idea of having two different comparison operators for
>> >> > the same Key class.
>> >> > This is erroneous flexibility - I can't imagine a design pattern which
>> >> > somehow can explain "having two different comparison operators" - it
>> >> > only adds a mess.
>> >>
>> >> No, having multiple comparison predicates can be very much sensible, as
>> >> there can be multiple ways in which two objects are considered
>> >> equivalent. For example, your unordered_set may use a subset of data
>> >> comprising the element for hashing and equivalence predicate, and you
>> >> may also have an operator== that compares the entire objects.
>> >>
>> >> --
>> >> Std-Proposals mailing list
>> >> Std-Proposals_at_[hidden]
>> >> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>> >
>> > --
>> > Std-Proposals mailing list
>> > Std-Proposals_at_[hidden]
>> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
napisał(a):
>
> C++ STL:
> 1) doesn't support debugging - no any warnings or infos are available;
What warnings? what info? And besides this could be this 1% cases I said before.
> 2) is not 99% effective (the same std::unordered_set just uses linked-list based buckets which is not so efficient);
Where did I say anything about performance? stl is designed to be
useful in general case, performance never "general" as every hash
map/set you
use in your program should be a different type to have 100% cpu
performance as you can put more restrictions that make sense on only
this one spot.
stl can't do this, it needs to be useful in a variety of use cases and
this cost performance in some specific cases.
> 3) STL now is not just a library, it is a part of C++ :D (cppreference.com is more about STL then of C++) and part of boost functionality is moving to STL on a regular basis (for example, smart pointers e.t.c.);
And?
> 4) having two comparison operators for the same class is a potential source of errors and misunderstanding (this is what I am talking about);
>
write clang-tidy plugin that checks for this, no standard change
required, others in 99% cases do not need to bother with this.
> 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.
>
"room for improvement" and "not proposed any changes", one or another.
In many cases you can't make improvements to existing types without
breaking some eggs...
Even adding a warning can break someone's code if they use `-Werror`
and have false positives.
>
> вс, 29 нояб. 2026 г. в 02:44, Marcin Jaczewski <marcinjaczewski86_at_[hidden]>:
>>
>> a) Write your own hash set, std lib is for 99% use cases, if you are
>> in the last 1%, then you should do it yourself.
>> b) Write a clang-tidy plugin that detects code you do not want.
>>
>> sob., 28 lis 2026 o 21:20 Aleksandr Povaliaev via Std-Proposals
>> <std-proposals_at_[hidden]> napisał(a):
>> >
>> > First, this is a potential source of errors. If a Key can be logically split into independent entities, then a redesign is in the order. Or you can use tuple<SubKey1, SubKey2, ... SubKeyN>.
>> >
>> > Second, this is an ineffective way of storing Key in cache-friendly unordered_set structure (not so friendly :D but more friendly then, let's say, std::set).
>> >
>> > Third, when updating a particular element in unordered_set structure, you may get an unwanted (Key1, Value2) combinations: for example, there is a (Key1, Value1) pair in the unordered_set structure already, and you're going to update it with (Key2, Value2) pair. You will find a Key1 == Key2 by comparing only part of it, and then update Value1 -> Value2. So, again this is a potential source of errors.
>> >
>> > сб, 28 нояб. 2026 г. в 22:34, Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]>:
>> >>
>> >> On 28 Nov 2026 21:14, Aleksandr Povaliaev via Std-Proposals wrote:
>> >> > I don't like the idea of having two different comparison operators for
>> >> > the same Key class.
>> >> > This is erroneous flexibility - I can't imagine a design pattern which
>> >> > somehow can explain "having two different comparison operators" - it
>> >> > only adds a mess.
>> >>
>> >> No, having multiple comparison predicates can be very much sensible, as
>> >> there can be multiple ways in which two objects are considered
>> >> equivalent. For example, your unordered_set may use a subset of data
>> >> comprising the element for hashing and equivalence predicate, and you
>> >> may also have an operator== that compares the entire objects.
>> >>
>> >> --
>> >> Std-Proposals mailing list
>> >> Std-Proposals_at_[hidden]
>> >> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>> >
>> > --
>> > Std-Proposals mailing list
>> > Std-Proposals_at_[hidden]
>> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-11-29 01:09:47
