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