Property access to a struct that contains struct
Mike Parker via Digitalmars-d
digitalmars-d at puremagic.com
Sun Feb 26 03:18:12 PST 2017
On Sunday, 26 February 2017 at 11:05:42 UTC, Guenter wrote:
> Hi,
>
> i do not understand where I am wrong in this code. I seems
> there is a missing constructor, but i have no idea where.
>
> @property A_t ext() { return fext; }
Structs in D are value types, so you're returning a copy of fext
here and that's what's getting updated with the new value. Try
this:
ref A_T ext() { return fext; }
More information about the Digitalmars-d
mailing list