Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-10-14 12:29:03


> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Andrew
> Hundt
> Sent: Friday, October 14, 2011 5:04 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
>
> >  * unchecked_push_back which does what it says; AND
> >  * checked_push_back which does what it says; AND
> >  * push_back which calls one or the other based on a policy
> >
> > That leaves just one thing to quibble about - the default value of the
> > policy - but even that choice becomes less important, because those
> > who feel strongly about the default behaviour of push_back being one
> > or the other can just use the explicitly-named version instead.
> >
>
> I love the sound of design-by-committee in the morning :-)
>
> More seriously, I do think that makes sense since it allows the user to select the appropriate
function for
> their design, but use the alternate one when necessary.
>
> If this is what is finally settled on, I would prefer to default to a checked policy because then
it will catch
> and prevent mistakes by default. If you have an exceptional reason for the performance, you can
switch to
> the alternate function/policy.

I also prefer checked by default.

But it is true that a policy solution will impose a run-time penalty? Can't it be a compile-time
choice?

Of course, there still remains opportunity for the design-by-committee members to discuss what the
default should be ;-)

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

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