Is i = i + 1
faster than ++i
for C++11? I hear that ++i
is faster than i++
for classes, but not for simple types. Is there a similar comparison between i = i + 1
and these other two?
Thanks!
EDIT 1: I use g++, but I'd be happy to know how this works on other compilers as well.
EDIT 2: This question is different from this one because it specifically asks about i = i + 1
, as opposed to just talking about the difference between ++i
and i++
.
EDIT 3: (TonyD - grammatically edited by QuantumFool) The i = i + 1
aspect of the question is a duplicate of this