Is it a good idea to pass parameters as rvalue references just to make it clear that you're going to manipulate the argument? Kinda like the opposite of const correctness.
For example, this function that takes a vector of strings, manipulates it somehow and returns a boolean value:
static bool isThisSomething(std::vector<string>&& input1);
Now if the caller wants to call this function with an lvalue, he has to use std::move()
and acknowledge that this vector will be messed with. This should prevent unexpected side effects.
std::vector<std::string> lvalueVector = {"foo", "bar"};
bool somethingness = isThisSomething(std::move(lvalueVector));
Clarification:
The manipulations that isThisSomething
does, are just part of some internal logic and would appear like nonsense for the caller.