Consider this:
std::vector<std::string> f() //some irrelevant function
{
std::vector<std::string> tempCol;
...//some more irrelevant stuff
return tempCol;
}
const std::vector<std::string>& refToLocal = f();
I know that this compiles and runs perfectly. I even know even that is is used variously in the production code. So the question is, does the local object must be deleted after the function scope?? how the reference 'attaches' to must have deleted local object???