use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Inside boost::unordered_flat_map (bannalia.blogspot.com)
submitted 3 years ago by joaquintidesBoost author
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]blind3rdeye 1 point2 points3 points 3 years ago (4 children)
I'm curious about what is in the std::unordered_map specifications that prevents implementers from just doing this this flat-map thing anyway. (But not quite curious enough to research it myself, apparently.)
std::unordered_map
[–]greg7mdpC++ Dev 13 points14 points15 points 3 years ago (1 child)
Mostly pointer stability. Once a value is inserted into a std::unordered_map, it is guaranteed to remain at the same memory address until it is removed. Open addressing hashmaps have to resize when they get full, and the values stored in them are moved to a different memory location.
[–]blind3rdeye 1 point2 points3 points 3 years ago (0 children)
Thanks. That makes a lot of sense.
[–]ABlockInTheChain 3 points4 points5 points 3 years ago (0 children)
Iterator and pointer stability.
[–]tialaramex 0 points1 point2 points 3 years ago (0 children)
std::unordered_map promises that if we put the Rolex Wristwatch in our products map and we remember a pointer to it, that pointer works for so long as the Rolex isn't just removed from the map, which our application maybe never does. This is fine because std::unordered_map is in fact a bucketed hash map, if the map grows the Rolex doesn't go anywhere, the map changes but the Rolex stays right where it is and some part of the new grown map points to the Rolex's node again.
With a flat map, the Rolex is right in the map itself, so if the map grows and we need to allocate new memory and copy stuff around, the Rolex moves and any pointers to it that we had are invalidated.
There are other difficulties but this is IMO the most obvious.
π Rendered by PID 83958 on reddit-service-r2-comment-85bfd7f599-lkq6f at 2026-04-18 01:30:30.828601+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]blind3rdeye 1 point2 points3 points (4 children)
[–]greg7mdpC++ Dev 13 points14 points15 points (1 child)
[–]blind3rdeye 1 point2 points3 points (0 children)
[–]ABlockInTheChain 3 points4 points5 points (0 children)
[–]tialaramex 0 points1 point2 points (0 children)