On Friday, 16 March 2012 at 15:10:06 UTC, Manu wrote:
Interesting approach, how will that affect 'thing's type?
It will strictly be myAttribute!int, but alias this
means that you can pass it anywhere an int is expected
too (and assign ints to it all the same).
Check it:
void cool(int a) {}
void main() {
myAttribute!int thing;
thing.refresh = true;
thing = 10; // we can assign ints to it, like if it was
an int
assert(thing.bNeedsAttention); // should be unchanged
int a = thing; // no problem, thing is usable as an int
assert(a == 10);
cool(thing); // ditto
}