Faster way to .dup an AA?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed May 2 07:11:51 PDT 2007
"Chris Nicholson-Sauls" <ibisbasenji at gmail.com> wrote in message
news:f19958$1a8g$1 at digitalmars.com...
> Which infers to me that AA's are referance types perchance?? At least
> insofar as arrays are, as a struct with a pointer? This means there may
> be a "hack" to get a direct dup using memcpy, but I'm not sure how to get
> at that pointer safely. Bah.
They are. The hash tables themselves are allocated on the heap, and then
each element is a binary tree of heap-allocated nodes. Making it very
difficult to duplicate them, even if I use a non-portable hack.
I think I'll write a double hash table which doesn't use separate chaining.
That way, I'll be able to copy all the data with "newTable.data =
oldTable.data.dup".
More information about the Digitalmars-d-learn
mailing list