static alias this
jkpl via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 7 06:34:10 PST 2015
Another try
E)-------------------------------------------
struct StaticRegister {
static private uint _value;
@property static uint value() { return _value; }
@property static void value(uint v) { _value = v; }
static uint opCall(){return _value;}
alias _value this;
}
void main(string[] s) {
StaticRegister = 1;
assert(StaticRegister()==1);
}
Yes you're right, it's a bit strange that the writer works...does
the expression 'static this' make sense ?!
More information about the Digitalmars-d-learn
mailing list