title: In C++, is A+=B preferable to A=A+B in the same way ++A is to A++?
body: <p>In C++, is A+=B preferable to A=A+B in the same way ++A is to A++?</p>
  
  <p>I understand that a "++A" preincrement is guaranteed to be at least as fast as a "A++" postincrement. This is discussed many places including <a href="https://herbsutter.com/2013/05/13/gotw-2-solution-temporary-objects/" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/484462/difference-between-i-and-i-in-a-loop?lq=1">here</a>. Likewise, A+=B is expected to be at least as fast as A=A+B, as <a href="https://stackoverflow.com/questions/5031604/is-a-b-more-efficient-than-a-a-b-in-c">here</a>.</p>
  
  <p>I was looking at this for ++:</p>
  
  <pre><code>//From https://herbsutter.com/2013/05/13/gotw-2-solution-temporary-objects/
  T T::operator++(int)() {
  auto old = *this; // remember our original value
  ++*this;          // always implement postincr in terms of preincr
  return old;       // return our original value
  }
  </code></pre>
  
  <p>My reasoning is that in the worst case (probably from complex object types) A=A+B would have to retrieve and store A and add in B before saving it back to the original A location, while A+=B would take B and add it to A directly. Is my reasoning correct?</p>
  
  <p>It is expected that basic types are rearranged as the same at compile time, and that this really only applies to complex objects requiring operator overloading.</p>
  
  <p>Does this extend generically to most imperative languages?</p>