What are copy elision and return value optimization?
Introduction For a technical overview – skip to this answer. For common cases where copy elision occurs – skip to this answer. Copy elision is an optimization implemented by most compilers to prevent extra (potentially expensive) copies in certain situations. It makes returning by value or pass-by-value feasible in practice (restrictions apply). It’s the only … Read more