Array Appending Plus Postblits
Steven Schveighoffer
schveiguy at yahoo.com
Wed Nov 24 05:05:29 PST 2010
On Tue, 23 Nov 2010 23:43:34 -0500, dsimcha <dsimcha at yahoo.com> wrote:
> I was browsing through druntime's lifetime.d for an unrelated reason and
> I
> noticed that, when an array is copied for the purpose of appending to
> it, the
> postblits are not called on the new array if it is an array of structs.
> Is
> there something I'm missing, or is this a bug that somehow noone has
> noticed
> up to this point?
Array appending does not respect any of the new copy construction
semantics. It basically does a memcpy and that's it. It doesn't even
respect shared (shared data is memcpy'd just like any other data),
although it does use a lock to protect shared appends.
I see there is a postblit function in the typeinfo, so it should be
possible to do the right thing.
One thing I'm unsure of is how postblit works on const or immutable
structs, anyone know? There is no typechecking in the array functions,
everything is a void[].
File a bug on it please.
-Steve
More information about the Digitalmars-d
mailing list