I must correct me: your solution works only with if (vs2 == Vector2s(vf)) { writeln("equal"); } but not with if (vs2 == vf) { writeln("equal"); }