Trying to use rightvalues a bit more but I got confused, how should I design my function in which I want to use the right value:
// Pass by whatever-it's-called
void RockyBalboa::DoSomething(std::string&& str){
m_fighters.push_back(str);
}
// Pass by reference
void RockyBalboa::DoSomething(std::string& str){
m_fighters.push_back(std::move(str));
}
And what is effectively the difference between these two function calls? And what happens when I pass it with double ampersand and use std::move
?