I think I'm still confused about the practical use of std::move
Note: I'm working in Visual Studio 2013 for reasons, so I'm using C++11.
I get the idea of transferring ownership, but I seem to be missing something. Here's some sample code (off the top of my head -- work makes it hard to share real code)
std::string tmp = std::to_string(i) + std::to_string(j);
if (someCondition()) {
const std::string tmp2 = getSomeString();
if (IsValidData(tmp2))
tmp = std::move(tmp2);
else if (i == 0 && j == 0)
tmp = "??";
else
tmp = std::move(tmp2);
}
Coverity is telling me that the std::move calls are ineffective. I added them because of Coverity suggestions on an earlier version of this code, and it made sense then. Since std::string has to own its data, I don't understand how the move is ineffective? Is it because I don't do anything else with tmp2, and thus ownership isn't an issue?