Rule of Zero

Interesting take on the need or otherwise to write move constructors by R. Martinho Fernandes (Flaming Dangerzone) :-

So, we have arrived at the Rule of Zero (which is actually a particular instance of the Single Responsibility Principle):

Classes that have custom destructors, copy/move constructors or copy/move assignment operators should deal exclusively with ownership. Other classes should not have custom destructors, copy/move constructors or copy/move assignment operators.

Leave a comment

Filed under C++

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.