Copy elision is a compiler optimization technique used in C++ that removes unnecessary copying of objects. The language standard lets an implementation perform any optimization that leaves a program's observable behavior as if the standard had been followed exactly, and it additionally names a few situations in which copies may be dropped even though the visible behavior changes, for example when a temporary object is copied into an object of the same type. The best known case is return value optimization, in which the compiler builds a function's returned object directly in the caller's storage rather than creating a hidden temporary and copying it. Walter Bright implemented a technique of this kind in his Zortech C++ compiler around 1991, and the named variant is called named return value optimization. From C++17 the standard guarantees copy elision in certain cases, so that a value is constructed directly in its final destination. GCC offers the option -fno-elide-constructors to switch the behavior off so that the effect can be observed.
Connections
In Field
Source Copy elision (Wikipedia)
Invented
Source Copy elision (Wikipedia)
Sources
Copy elision (Wikipedia)
In Field: Programming Language Theory, Lead
In C++ computer programming, copy elision refers to a compiler optimization technique that eliminates unnecessary copying of objects.
In Group: Compiler and Language Implementation Techniques, Lead, group placement
In C++ computer programming, copy elision refers to a compiler optimization technique that eliminates unnecessary copying of objects.
Invented: Walter Bright, Background
Around 1991, Walter Bright implemented a technique to minimize copying
View the SourceReader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.