Is the Rule of 5 (for constructors and destructors) outdated?

The full name of the rule is the rule of 3/5/0.

It doesn’t say “always provide all five”. It says that you have to either provide the three, the five, or none of them.

Indeed, more often than not the smartest move is to not provide any of the five. But you can’t do that if you’re writing your own container, smart pointer, or a RAII wrapper around some resource.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)