C++17: Efficiently Returning std::vector from Functions
The discussion centers on returning std::vector from C++ functions, highlighting Return Value Optimization (RVO) introduced in C++17. RVO allows the compiler to avoid copying vectors by constructing them in place when there's a single return path. For multiple return paths, std::move is used to transfer ownership efficiently. Exceptions exist, particularly with the conditional operator, which requires copying. Returning references from member functions is safer than from free functions since the object's lifetime ensures validity.
