...

/

Named Return Value Optimization

Named Return Value Optimization

Here we learn about how compilers use NRVO and Eliding to optimize.

We'll cover the following...

Compilers and NRVO

Compilers are even smarter, and they can el​ide in cases when you return a named object - it’s called Named Return Value Optimization - NRVO

Test Create()
{
Test t;
// several instruction to initialize 't'...
return t;
}
auto n = Create(); // temporary will be usually elided
...