"Best" way of passing in a big struct to a function?
Val Markovic
val at markovic.io
Tue Oct 9 21:39:51 PDT 2012
On Wednesday, 10 October 2012 at 04:55:48 UTC, Val Markovic wrote:
> Oh, and a related question: what is the best way to pass in an
> associative array like CustomStruct[string]? I can't say I'm
> too clear on how AA's are managed/implemented. Do they have
> value semantics or reference semantics? What about lists?
Ok, feel free to disregard this question; I just checked TDPL
(should have done that first) and it clearly says that AA's
follow reference semantics. Dynamic arrays passed to functions
actually pass in a light-weight object referring to the same
underlying data (I'm guessing that a dynamic array is internally
"nothing more" than a struct holding a pointer and a length,
right?).
More information about the Digitalmars-d-learn
mailing list