property += operator
SrMordred
patric.dexheimer at gmail.com
Thu May 10 18:43:40 UTC 2018
struct T
{
int x;
@property ref X(){ return x; }
@property X(int v)
{
x = v;
}
}
T t;
t.X += 10;
The setter 'x = v' are not executed because i´m returning the
reference of x.
And without the 'ref' the compiler complains because 'x' is not a
lvalue.
Any solution to make it work like native arr.length+=10 works?
( I Thought on returning a struct with "+=" operator but it is a
strange solution )
More information about the Digitalmars-d-learn
mailing list