Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return value optimization of values unpacked from std::tuple

Are there any compilers capable of performing return value optimization on multiple values returned from a function through std::tuple? To be clear, in the following code, are there any compilers capable of avoiding unnecessary copies?

std::vector<int> a;
std::list<float> b;
std::tie(a,b) = myFunctionThatReturnsAVectorAndList();
like image 745
tgoodhart Avatar asked Feb 15 '11 18:02

tgoodhart


1 Answers

It's not worth worrying anymore. If the compiler cannot perform RVO, move semantics will kick in.

like image 77
fredoverflow Avatar answered Sep 25 '22 22:09

fredoverflow