c++11 Return value optimization or move? [duplicate]

This question already has answers here: C++11 rvalues and move semantics confusion (return statement) (6 answers) Closed 4 years ago. I don’t understand when I should use std::move and when I should let the compiler optimize… for example: using SerialBuffer = vector< unsigned char >; // let compiler optimize it SerialBuffer read( size_t size ) … Read more