Boost logo

Boost :

From: Simon Buchan (simon_at_[hidden])
Date: 2005-10-03 19:03:09


Ian McCulloch wrote:
> Boris wrote:
>>"Pavel Vozenilek" <pavel_vozenilek_at_[hidden]>,
>>>How would such dynamic_array be better (different) than std::vector?
>>
>>I wouldn't say it's better. It would be just a bit more suitable in a
>>situation where you know that you will deal with a fixed number of
>>elements at runtime. The interface would be probably similar to
>>std::vector but without inserting/removing operations. While std::vector
>>is the natural choice when you need a dynamic array and boost::array when
>>you know the (fixed) size at compile time this new array type (whatever
>>the name would be) would be chosen when you know the (fixed) size only at
>>runtime.
>
> You still have not stated what advantages such a container would have over a
> resizable container. In other words, if you omit the resize() et. al. from
> std::vector, what extra functionality can be gained in return?

I'm assuming there's some room for optimisation (most std::vector's
allocate head-room, for example, which may be bad if, say, you're
allocating a vector to hold every prime below 5,000,000, after you use
Erasmus' Sieve to find them). Probably not too much need, though.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk