mercredi 2 décembre 2020

Does changing from private constructor/assignment operator to deleted breaks compatibility?

Using C++11.

I have a class I want to clean-up a bit by making the following changes:

From

class MyClass {
public:
  // code
private:
  MyClass(const MyClass&);
  MyClass& operator=(const MyClass&);
  // members
};

To

class MyClass {
public:
  // code
  MyClass(const MyClass&) = delete;
  MyClass& operator=(const MyClass&) = delete;
private:
  // members
};

Knowing that both are declared but not defined, will this change break binary compatibility? Does it improves anything?

Aucun commentaire:

Enregistrer un commentaire