From: John Max Skaller (skaller_at_[hidden])
Date: 2001-08-20 19:52:59
Ed Brey wrote:
> For classes of problems where you need to allocate first
> and then fill randomly into the buffer,
> the initialization cost of a vector is a significant overhead,
> and I don't see how you could get rid of it without changing the interface.
> (Of course, one could create lazy constructors and copy constructors for the
> contained objects, but that would be more horsing around than using, say, a VLA.)
Sure, but I don't see how VLA'a would help here.
If you declare an array (of any kind: C array, vector, VLA, or
you always have to initialise the elements. If the default constructor
does nothing, you can optimise the array constructor to do nothing.
Otherwise, you can't: you need to make an array of some dummy
types the same size and alignment, dynamically construct
the elements, and cast the array element type one way or another.
My gripe here is that the core language lacks
any way to create an array of bytes 'aligned like T'.
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 New generation programming language Felix http://felix.sourceforge.net Literate Programming tool Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk