Re: "Best" way of passing in a big struct to a function?

2012-10-09 Thread Val Markovic
This whole topic is a bit of a thorny one in that D's design is trying to avoid some of the problems that allowing const T& to take rvalues in C++ causes, but it makes a situation like what you're trying to do annoying to handle. And auto ref doesn't really fix it (even though that's whole the

Re: "Best" way of passing in a big struct to a function?

2012-10-09 Thread Val Markovic
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 refe

Re: "Best" way of passing in a big struct to a function?

2012-10-09 Thread Val Markovic
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?

"Best" way of passing in a big struct to a function?

2012-10-09 Thread Val Markovic
TL;DR: what should I use if I need C++'s const& for a param? Long version: I have a big struct provided by a library and I'm trying to pass instances of it to a function that will never need to modify the passed in value. Naturally I want to pass it efficiently, without incurring a copy. I kno