opDispatch

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 25 08:08:19 PST 2014


On Thursday, 25 December 2014 at 16:02:48 UTC, Danny wrote:
> Tobias: Thanks! Your version works. But now it's read-only.

Make the opDispatch function return ref and then you can write to
it.

Alternatively, write a second setter opDispatch overload:

T opDispatch(string name, T)(T rhs) {
        return mixin("value." ~ name ~ " = rhs");
}


More information about the Digitalmars-d-learn mailing list