T opCast(T : const(Vector2D!U), U)() const
{
    return new T(x, y);
}

Awesome, now i only need this three and it works perfect.

typeof(this) opCast(T)() if (isImplicitlyConvertible!(typeof(this), T)) {
        writeln("implicit cast");
        return this;
}

const(typeof(this)) opCast(T)() const if (isImplicitlyConvertible!(typeof(this), const T)) {
        writeln("implicit const cast");
        return this;
}

T opCast(T : const(Vector2D!(U)), U)() const {
        writeln("Other cast");
        return T(x, y);
}

Many thanks to you two! :)


Reply via email to