dimanche 1 avril 2018

how to compare the efficiency of std::move and non std::move

i am confused with using std::move in my project. So, which one do you think is better, more efficenct?

void foo( const std::string& d)
{
    //....
}

void func1()
{
    std::string c;
    foo(c); 
}

void func2()
{
    std::string c;
    foo(std::move(c));
}

which function do you choose func1 or func2 and why?

Aucun commentaire:

Enregistrer un commentaire