Top "Copy-elision" questions

Copy elision refers to an exception to the as-if rule allowing to omit copies

What are copy elision and return value optimization?

What is copy elision? What is (named) return value optimization? What do they imply? In what situations can they occur? …

c++ optimization c++-faq return-value-optimization copy-elision
How can a unique_ptr be returned by value without std::move?

std::unique_ptr<int> ptr() { std::unique_ptr<int> p(new int(3)); return p; // Why doesn't …

c++ c++11 move-semantics copy-elision
How does guaranteed copy elision work?

At the 2016 Oulu ISO C++ Standards meeting, a proposal called Guaranteed copy elision through simplified value categories was voted into …

c++ c++17 copy-elision
What is copy elision and how does it optimize the copy-and-swap idiom?

I was reading Copy and Swap. I tried reading some links on Copy Elision but could not figure out properly …

c++ optimization copy-and-swap copy-elision
C++ return value optimization

This code: #include <vector> std::vector<float> getstdvec() { std::vector<float> v(4); v[0] = 1; v[1] = 2; …

c++ return-value-optimization copy-elision
How to in-place initialize an array?

How can I initialize an array without copy or move-constructing temporary elements? When the element has an explicitly deleted copy …

c++ arrays in-place copy-elision deleted-functions