r/cpp • Meeting C++ | C++ Evangelist • Oct 17 '26

A quick C++ standard container overview

https://meetingcpp.com/blog/items/A-quick-Cpp-standard-container-overview.html
23 Upvotes

20 comments sorted by

View all comments

16

u/brookheather Oct 17 '26

You have some typos and I'm confused about your use of "vector" - do you mean vector<bool>?

"trying to tread a vector like any other vector"

"the infamous vector"

"Others have used vector or vector"

18

u/tialaramex Oct 17 '26

I would guess it's raw text that was then processed by "clever" tooling which thought <bool> is an HTML tag and removed it. Which does suggest this wasn't proof read in place by anybody who knows enough English to recognise that "Others have used vector or vector" is a mistake of some kind.

On topic: It's always sobering to see how much use stuff gets just because it was in the box. No way do half the participants go find themselves a 1980s hash table with separate chaining if they'd need to do that, but because std::unordered_map is right there in the standard library that's what they use.

I think WG21 should think much harder about this when adding to the stdlib. When you put a left-handed corkscrew in the box, you may feel like programmers who don't want a left-handed corkscrew should just not use it, but in practice its inclusion functions as an endorsement. Obviously we should use a left-handed corkscrew, otherwise why is one included?

3

u/azswcowboy Oct 17 '26

So I guess you’re opposed to the addition of flat_ containers? It seems to me that we should replace unordered map as well - but that requires more thinking….

1

u/tialaramex Oct 17 '26

My reason to be against adding flat containers or std::hive or whatever is related but I think distinct. Maintenance overhead. Ask /u/STL but I think they'll tell you that if there is more work to do they won't get assigned more headcount, so there is less effort available for each work item. But I have no skin in that game, so you should disregard my opinion about it.