If in my code, I have declared a variable (for example string) and want to pass to some function so my vector would add that value. Do I always need to do this(using the std::move), considering I do not need that passed variable anymore?
Void add(string s){
my_vector.push_back(move(s));
}
I do know that I can simply pass an rvalue but consider if I needed to declare the string first (making it an rvalue) and then adding it to the vector.
Because I don’t want to copy the variable and then push back to my vector