Cast Object - get null

Namespace rswhite4 at googlemail.com
Wed Apr 18 23:25:13 PDT 2012


Wow, many thanks for your trouble. Now it works as aspected.
I only need

T opCast(T)() const if(isImplicitlyConvertible!(typeof(this), T)) 
{
	return this;
}

to work.

But if i try to cast to a const like this
const Vector2s vs_ = cast(Vector2s)(vf);

I get a long list of compiler errors.
Thereby it's petty if i have only

T opCast(T)() const if(isImplicitlyConvertible!(typeof(this), T)) 
{
	return this;
}

or additional the const variant

const(T) opCast(T)() const 
if(isImplicitlyConvertible!(typeof(this), const T)) {
	return this;
}


More information about the Digitalmars-d-learn mailing list