Guaranteed Copy Elision

The new C++17 standard brings many exciting new features. A smaller, more subtle improvement it brings is guaranteed copy elision. The keyword is guaranteed, as copy elision itself has always been part of the standard. Although it might not be a change as radical as, say, structured bindings, I’m very happy to see it made it into the standard. Table of Content Copy Elision Return Value Optimization Passing a Temporary by Value Throwing and Catching Exceptions by Value Guaranteed Copy Elision Value Categories Addendum: Translation Units Addendum: Copy-List-Initialization Copy Elision Before discussing what changed in the latest version of the standard, it might be useful to revisit the basics of copy elision as they are currently defined by the C++14 standard....

November 21, 2016