Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2011-10-15 12:10:48

Peter Dimov wrote:
> Adam Wulkiewicz wrote:
>> I'd rather use the following:
>> while ( sv.size() < sv.capacity() && keep_pushing )
>> // do a push_back into a static_vector
> Yeah, if you get to rewrite all the functions that lead to the
> push_back. Like spirit::parse and everything it calls.

Yes and should I know what spirit::parse do if some exception is thrown
inside? Maby it returns empty vector, whatever? Is it aware that some of
the exceptions are ok? I don't know it and I do not want to know it.

 From the previous example. If you know that you need only 4 elements
and you use std::vector since there is no static_vector yet, must you
parse all of the elements? You'll probably provide some wrapper/adaptor.
This adaptor will probably work with std::vector and static_vector as
well. Not to mention all other containers that has push_back().

This usage is some special case. Of course, you'll find some number of
those but in general this way of thinking will be wrong.


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