Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-10-15 10:48:56

Dave Abrahams wrote:
> on Sat Oct 15 2011, "Peter Dimov" <> wrote:
> > What are the "proper" uses for it?
> It sounds like you're asking me to prove something for which we both
> know there's no proof.

Not really. As I already said in the other message, doing more push_backs
than a compile-time constant size is a logic error only when the number of
push_backs is a compile-time constant as well. So, it follows that it is
only proper to use static_vector when the number of push_backs is known at
compile time. So I was wondering what some of these (nontrivial and variable
size) uses are.

As an example, a case in which 99.4% of the time the number of push_backs
doesn't exceed capacity is a legitimate use, but it's not a logic error, and
quite fits the mantra that "exceptions should be exceptional".

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