Boost logo

Boost :

Subject: Re: [boost] [container] varray aka static_vector
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-02-13 18:10:56

2013/2/13 Nevin Liber <nevin_at_[hidden]>

> On 13 February 2013 10:51, Krzysztof Czainski <1czajnik_at_[hidden]> wrote:
> > I mean the noinit_t trick - can that be done for resize just by writing
> an
> > Allocator? I don't see how.
> >
> No, as you basically need two different placement new syntaxes to make it
> work.
> I'm not sure how much the ability to control default vs. value
> initialization on a per element basis (as opposed to a per container basis,
> which allocators give you) really comes up in practice.

My main concern isn't, that I'll ever need both in the same container (but
maybe I will). The main point is I'd rather know, that emplace_back() and
resize() always zero-initialize without having to check the details of the
Allocator used. And so, I'd rather see a different function call for
non-initializing operations.

One can also apply the same reasoning to direct vs. list initialization.

I think the same arguments apply to list initialization, but I only think
about it as a mind exercise, since I don't have any use-cases for it ;-)

> Do we really need all these knobs, or are we just adding them because we
> can?

I see a need for noinit versions, and with list initialization - yes it's
just for fun ;-)


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