Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-20 09:49:57


From: "Ed Brey" <edbrey_at_[hidden]>
> I agree with you that the vector semantics aren't a problem per se. The
invariant that stems from the initialization semantic keeps the interface
nice and simple. The question is: how should one program algorithms that
need deferred initialization of elements? If vector is to be the end all
and do all dynamic array type, replacing VLAs et al., it needs to answer
this question. Could you elaborate on what you have in mind?
<

Well, for UDT classes with constructors, even a C-style array will
initialize elements. For ints, chars, etc, about the only reason I see for
not wanting the elements initialized is that the storage will be passed to a
C function that will overwrite it anyway. Assuming a memset-ting vector, the
unnecessary initialization in this case is rarely a measurable problem.

Do you have some specific examples of algorithms that need deferred
initialization in mind?

--
Peter Dimov
Multi Media Ltd.

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