ref & address

Chris wendlec at tcd.ie
Wed Apr 16 10:05:25 PDT 2014


On Wednesday, 16 April 2014 at 16:21:42 UTC, Adam D. Ruppe wrote:
> What's the definition of InputRange? Is it the interface from 
> std.range?
>
> If so, don't pass it as ref. interfaces are references to the 
> object by default.
>
> In general, you only need ref when you want to assign a new 
> object to the variable and want that change to be seen outside 
> the function too.

InputRange is an array of structs. this is also a struct, a range 
that manipulates elements in the InputRange (i.e. it calculates 
values and stores them in fields of each struct that is in the 
array).


More information about the Digitalmars-d-learn mailing list