Difference between += and .+=

Specifically, x += y is x = x + y which will allocate a new vector for x+y and assign that to x. x .+= y is x .= x .+ y which won’t allocate a vector, and will modify x.

7 Likes