Another option is to use the Pimpl idioms.
class Foo { public: Foo() : pImpl(new FooImpl) {}
The copy assignment operator is private from POV of Foo clients, but you can still use the compiler generated using FooImpl. A compromise arises when implementing the member functions of Foo, because now you have to access the data through the pImpl pointer.
source share