lundi 31 août 2015

Deleted vs empty copy constructor

Examples of empty and deleted copy constructors:

class A
{
public:
    // empty copy constructor
    A(const A &) {}
}

class B
{
public:
    // deleted copy constructor
    A(const A&) = delete;
}

Are they doing the same in practice (disables copying for object)? Why delete is better than {}?

Aucun commentaire:

Enregistrer un commentaire