lundi 3 avril 2017

Should I always use std::move in a constructor?

Are the move semantics used in Example A necessary, and which struct is superior?

Example A:

struct A
{
    int a;
    A( int a ) : a( std::move(a) ){ }
};

Example B:

struct B
{
    int b;
    B( const int& b ) : b( b ){ }
};

Aucun commentaire:

Enregistrer un commentaire