Coexistence of static and unstatic method

Namespace rswhite4 at googlemail.com
Sat Jun 30 03:20:39 PDT 2012


I've tried different things and that here indeed compiles, but 
does not work as it should/I want.

typeof(this) opCall(U, V)(U x, V y) if (__traits(compiles, { 
this.x = 5; })) {
	writeln("unstatic opCall");
	this.Set(x, y);

	return this;
}

static Vector2D!(T) opCall(U, V)(U x, V y) if 
(!__traits(compiles, { this.x = 5; })) {
	return new Vector2D!(T)(to!(T)(x), to!(T)(y));
}


More information about the Digitalmars-d-learn mailing list