From Jason Turner
Watch on YouTube

Summary

This episode explains why developers should prefer writing code that avoids explicit std::move calls. Using a simple example with a custom 'Lifetime' object, Jason demonstrates how relying on C++'s copy and move elision rules (particularly return value optimization) creates more efficient code than manually using std::move. He shows that properly structured code with simple, composable functions that return by value allows compilers to optimize away object creation and destruction overhead automatically, even at the lowest optimization levels.

Resources

Tags