문제

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();
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top