Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Nevin Liber (nevin_at_[hidden])
Date: 2011-10-16 02:59:03

On 15 October 2011 19:03, Nathan Ridge <zeratul976_at_[hidden]> wrote:
> Admittedly, I am in C++11-world and for this use case I was thinking of
> the move version of push_back(), or emplace_back() (yes, we do want
> these, and the fact that we haven't asked for them in this thread is simply
> because the recent discussion has been on a topic orthogonal to this,
> not because we don't want them).

Orthogonal or not, you're asking for a tiny optimization to a fairly
expensive call. Plus, in this case (filling a StaticVector to
capacity with copied values) either happens in a tight enough loop
that the optimizer is likely to optimize out the check, or so much
else is going on that the check is really in the noise.

My experience with optimization is that I tend to go after "the
biggest bang for the buck" first; it seems weird to go after the
smallest thing first.

And again, I'm not arguing that the unsafe but possibly faster
functionality shouldn't be there, but rather it shouldn't be spelled
the same way as the safe functionality in all the other containers.

 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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