Too early happy, now it seems opEquals wouldn't be called...
I tried this again:

U opCast(U)() const if (is(Unqual!U == Vector2D!byte) ||
                is(Unqual!U == Vector2D!ubyte) ||
                is(Unqual!U == Vector2D!short) ||
                is(Unqual!U == Vector2D!ushort) ||
                is(Unqual!U == Vector2D!int) ||
                is(Unqual!U == Vector2D!uint) ||
                is(Unqual!U == Vector2D!long) ||
                is(Unqual!U == Vector2D!ulong) ||
                is(Unqual!U == Vector2D!float) ||
                is(Unqual!U == Vector2D!double) ||
                is(Unqual!U == Vector2D!real))
        {
                return U(this.x, this.y);
        }

And normal casts works perfectly but what should i do if i get Object like in opEquals? I think you want me to say what I understand now slowly: it does not work with Object. Isn't it?
It's a very unhappy solution to call

if (vs == Vector2s(vf)) as simply if (vs == vf)

If there any other solutions or any ideas to fix my solution in my previous post?

Reply via email to