For example, if I have a function that moves a vector to a class member:
struct A
{
void f(std::vector<int> && v)
{
m_v = std::move(v); //1
}
std::vector<int> m_v;
}
void other_func()
{
std::vector<int> other_v;
A a;
a.f(std::move(v)); /2
}
should I use std::move two times? First when I pass the parameter and second when I assign the parameter to the member?
Aucun commentaire:
Enregistrer un commentaire