Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-10-15 19:21:34


[Sorry, e-mail client acting up, ignore my previous email]

[Nathan Ridge]
> Of course, both use cases are worthwhile and deserve having
> a class for them in boost, and one's push_back should assert
> and the other's should throw. We can call one capacity_array
> and the other stack_vector, or whatever better names we come
> up with - but let's not give them the same name, when they are
> very different beasts.

[Nevin Liber]
> > How could it ever be a "drop-in replacement for vector"
>
> For over a decade, the mental model for calling push_back, insert,
> resize, etc. is that it they have no preconditions to check. This is
> true *for every standard container* (which supports the corresponding
> operation, of course). You want to *silently* break that consistency.
> That will lead to buffer overrun bugs, which we know are hard to
> debug and

I don't have any strong feeling about this, but I would be OK with
changing the name of capacity_array's push_back() to something else
for this reason (in which case it would not have a method named
push_back at all).

Regards,
Nate
                                               


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