Re: Question about destructors
On Feb 8, 6:51*pm, Gareth Owen <gwo...@gmail.com> wrote:
> Ian Collins <ian-n...@hotmail.com> writes:
> > On 02/ 8/12 08:39 PM, 88888 Dihedral wrote:
> >> But for digital images and videos of tens of millions of pixels to be
> >> processed the C++ vector adds overheads, too.
> > No more than naked dynamic arrays.
> Well, possibly a little bit more (default initialisation, storing the
> length, and possibly some address calculation if you want to address it
> as if it were multidimensional, in zigzag fashion, say. Nothing you
> couldn't fix with a templated custom class, though.)
> And if those are the speed determining step of your algorithm, you're
> doing it wrong.
Default initialization was a major overhead in some of my image
code. I replaced std::vector with a home-grown dynamic_array<T> vector
like container that doesn't do default initialization. Problem solved.
It would be nice if it could be done with a custom allocator but you