One of my function takes a vector as a parameter and stores it as a member variable. I am using const reference to a vector as described below.
class Test {
The current advice on this is to take the vector by value and move it into the member variable:
void fn(std::vector val)
{
m_val = std::move(val);
}
And I just checked, std::vector does supply a move-assignment operator. If the caller doesn't want to keep a copy, they can move it into the function at the call site: fn(std::move(vec));.