assert(Vec2(1, 2) + Vec2(3, 4) == [1f+3f, 2f+4f]); assert(Vec2(1, 2) - Vec2(3, 4) == [1f-3f, 2f-4f]); assert(Vec2(1, 2) * Vec2(3, 4) == [1f*3f, 2f*4f]); assert(Vec2(1, 2) / Vec2(3, 4) == [1f/3f, 2f/4f]); assert(__traits(compiles, Vec2(1, 2) + [3, 4])); assert(Vec2(1, 2) + Vec1(3) == [1f+3f, 2f]); assert(Vec2(1, 2) - Vec1(3) == [1f-3f, 2f]); assert(Vec2(1, 2) * Vec1(3) == [1f*3f, 2f]); assert(Vec2(1, 2) / Vec1(3) == [1f/3f, 2f]); assert(Vec2(1, 2) + Vec3(3, 4, 5) == [1f+3f, 2f+4f, 5f]); assert(Vec2(1, 2) - Vec3(3, 4, 5) == [1f-3f, 2f-4f, 5f]); assert(Vec2(1, 2) * Vec3(3, 4, 5) == [1f*3f, 2f*4f, 5f]); assert(Vec2(1, 2) / Vec3(3, 4, 5) == [1f/3f, 2f/4f, 5f]); assert(Vec2i(1, 2) + Vec2(3, 4) == [1+3f, 2+4f]);
Returns a new vector with the results of applying operator against elements of other. If operands dimensions are unequal, copies the values from greater dimension vector.