mercredi 5 août 2015

C++ Rvalue and move

Please help to understand on below

class Demo {};
    Demo && fun() {
        Demo d;
        cout << "Addres of d in fun " << &d << endl;
        return move(d);
    }
int main()
{
    Demo && d = fun() 
}

Is this the correct way to return object ??

Aucun commentaire:

Enregistrer un commentaire