Top "Return-value-optimization" questions

C++ copy-elision of return-values.

c++11 Return value optimization or move?

I don't understand when I should use std::move and when I should let the compiler optimize... for example: using …

c++ c++11 move return-value-optimization rvo
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
In C++, is it still bad practice to return a vector from a function?

Short version: It's common to return large objects—such as vectors/arrays—in many programming languages. Is this style now …

c++ c++11 coding-style return-value-optimization
Proper way (move semantics) to return a std::vector from function calling in C++11

I want to fill std::vector (or some other STL container): class Foo { public: Foo(int _n, const Bar &_…

c++ stl c++11 move-semantics return-value-optimization
Move or Named Return Value Optimization (NRVO)?

Lets say we have the following code: std::vector<int> f() { std::vector<int> y; ... return …

c++ optimization c++11 move-semantics return-value-optimization
C++: returning by reference and copy constructors

References in C++ are baffling me. :) The basic idea is that I'm trying to return an object from a function. …

c++ reference return-value-optimization return-by-reference
Disabling g++'s return-value optimisation

What flag(s) do I need on the command line to disable the return-value optimisation automatically enabled by the g++ …

c++ optimization compiler-construction g++ return-value-optimization
C++ get method - returning by value or by reference

I've go a very simple question, but unfortunately I can't figure the answer myself. Suppose I've got some data structure …

c++ reference return-value return-value-optimization
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
Is returning with `std::move` sensible in the case of multiple return statements?

I'm aware that it's normally not a good idea to return with std::move, i.e. bigObject foo() { bigObject result; /*...*/ …

c++ c++11 move-semantics return-value-optimization