
On Sat, Nov 9, 2013 at 11:26 PM, Jonathan Wakely
Boost's flat_set and flat_map are preferable as default container than std::set/map in almost all cases I've been working on in the last 5 years (which include time I couldn't use these containers in practice).
So you almost never need iterator and reference stability?
I do sometime need reference stability but far less often than one would expect. Fast lookup in (relatively) small maps or set are far more common in my experience.
Because if you don't need them, then yes, a sorted std::vector might be a better choice, or another container such as boost::flat_set, which is great and readily available from Boost - maybe you've heard of it ;-)
Yes and I use them a lot. :)
It looks like I'm not the only one praising these kind of containers:
I'm not saying they're not useful. I specifically said they're useful, you even quoted me saying that. Stop trying to convince me they're useful.
That was not my point but I might not have been clear. My point that I disagree with your following objection, but uniquely for these specific containers.
I'm objecting to the (IMHO too common) view that everything useful should be put in the standard. There are things missing from the standard (networking, databases, XML/XSLT processing, graphics) that would be better for the committee and implementors to spend time on than different containers with small-ish variations on the interfaces and properties of the existing standard containers. The flat_map and flat_set containers exist and are perfectly usable for those who want them.
I understand your objection in general, but I also believe it's actually problematic that there is no sorted vector kind of containers in the standard library today. I also hoped that more very useful boost libraries would get standardized faster. I'll stop here for the talking anyway, there is no point in convincing anyone here I guess. :)