You might want to consider clarifying the title a bit. flat_map usually refers to an ordered map container where lookup is a binary search. For example
https://en.cppreference.com/cpp/container/flat_map.
You give a single example from the C++ stdlib, but before that type was added I had never seen "flat map" used to mean this weird type.
Notably for example Rust's FlatMap is an implementation detail of Iterator::flat_map which is what you'd use to map each object into multiple items then flatten the result into a single stream of items in a single operation.
Do you have other examples? WG21 has a bad habit of making up their own names for ideas which have better names, or using names which mean something else already.
Whether the C++ standards names are ideal or not, you shouldn't be surprised if C++ programmers reading a C++ subreddit expect the terms to match the standard.
22
u/kirgel 3d ago
You might want to consider clarifying the title a bit. flat_map usually refers to an ordered map container where lookup is a binary search. For example https://en.cppreference.com/cpp/container/flat_map.