Properties and std.container.Array

Dicebot public at dicebot.lv
Thu Jan 9 05:32:07 PST 2014


On Thursday, 9 January 2014 at 12:19:25 UTC, Frustrated wrote:
> I guess I see what is going on. Since Array is a struct, a 
> local copy is made and that never ends up updating the original?
>
> How can I use it then like an object so this is not a problem?

returning by ref may do what you want:

@property std.container.Array!int arr() { return _arr; }
->
@property ref std.container.Array!int arr() { return _arr; }


More information about the Digitalmars-d-learn mailing list