Обложка канала

Библиотека C/C++ разработчика

14677 @cppproglib

Полезные материалы по всему, что может быть полезно плюсовику/сишнику.

Библиотека C/C++ разработчика

4 года назад
Открыть в
The Sad Truth About C++ Copy Elision

Copy elision is a C++ compiler optimization that, as its name suggests, eliminates extra copy and move operations. It is similar to the classical copy propagation optimization, but specifically performed on C++ objects that may have non-trivial copy and move constructors. In this post, I’ll walk through an example where an obvious optimization you might expect from your compiler doesn’t actually happen in practice. Introducing an extra variable to break up a long line Let’s say that you have a long function call that returns an object, and you want to immediately pass that object to another function, like this:

wolchok.org