I wish this help you The description in your question is pretty much correct. But it is important to understand that this is behavior of the abstract C++ machine. In fact, the canonical description of abstract return behavior is even less optimal result is copied into a nameless intermediate temporary object of type std::string. That temporary persists after the function's return. That nameless intermediate temporary object is then copied to greeting after function returns.
Return value optimization: ho can I avoid copy construction of huge STL containers.
Does that help It is meaningless. The type of RVO you mentioned is called named RVO (NRVO), and most compilers implement it. Regardless, in C++11, vector has move constructors, so even if NRVO didn't apply, it'd still be moved, not copied.
copy object with objects avoiding mutation of the initial object (avoid copy references)