alias this with template class?

Namespace rswhite4 at googlemail.com
Sun Jun 3 11:43:13 PDT 2012


I think this should work:

[code]
import std.stdio;

class Foo(T) {
public:
	T Num;
	
	@property
	Foo!(U) ConvertTo(U)() inout {
		return cast(Foo!(U)) this;
	}
	
	alias ConvertTo this;
}

void Call(const Foo!(float) FFoo) {

}

void main() {
	Foo!(ubyte) UbFoo = new Foo!(ubyte)();
	
	Call(UbFoo);
	
	readln();
}
[/code]

Why it doesn't?


More information about the Digitalmars-d-learn mailing list