digitalmars.D.learn - getter/setter in one function (almost)
- Ellery Newcomer (14/14) Jul 15 2013 unfortunately, dmd doesn't accept the signature as a valid property.
unfortunately, dmd doesn't accept the signature as a valid property. import std.stdio; import std.typecons; struct T { int _i; property int i(Nullable!int derp = Nullable!int.init) { return _i = derp.isNull ? _i : derp.get; } } void main () { T t; t.i = 1; writeln(t.i); }
Jul 15 2013