Boost logo

Boost :

Subject: Re: [boost] [containers] Are there flat_map/set and stable_vector proposals at work?
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2013-11-09 17:26:24

On 9 November 2013 15:37, Klaim - Joël Lamotte wrote:
> I think I would have have the advice for most non-standard containers, but
> I strongly disagree in the case of flat_set, flat_map and stable_vector.
> The standard containers don't provide enough basic alternatives and, at
> least in my experience and experiences I've read online and discussed with
> other C++ devs,
> we end-up often getting back to std::vector for almost anything.

Good, it's the right most for most situations :-)

> 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?
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 ;-)

> My understanding of the standard is that it should provide
> useful and widely used tools, like containers, which are then standard
> because everybody should use them
> by default.

According to Stepanov (and IIRC Stroustrup) everyone should use vector
by default :-)

> 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

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at