How to setup the c++ rule of three in a virtual base class
I am trying to create a pure virtual base class (or simulated pure virtual)
Reasoning to wait until third time in the Rule of Three?
I just came across the article “Rule of Three” in wikipedia
Is the rule of 5 a valid extension of the rule of 3, or does it imply premature optimization?
I’m familiar with the notion in c++ of the rule of 3, however since the release of C++11 I’ve seen some sources suggesting it should be extended to a “rule of 5”, I.e. the move constructor and move assignment operator should also be implemented whenever the others are. What is the rationale behind such a rule? My understanding is that in most cases implementation of move semantics is only necessary as an optimization – am I wrong about this, or is the so-called rule of five about optimizing my code (and, therefore, substantially less important than the rule of 3, which is about avoiding pitfalls that can lead to unexpected behaviors)?
Is the rule of 5 a valid extension of the rule of 3, or does it imply premature optimization?
I’m familiar with the notion in c++ of the rule of 3, however since the release of C++11 I’ve seen some sources suggesting it should be extended to a “rule of 5”, I.e. the move constructor and move assignment operator should also be implemented whenever the others are. What is the rationale behind such a rule? My understanding is that in most cases implementation of move semantics is only necessary as an optimization – am I wrong about this, or is the so-called rule of five about optimizing my code (and, therefore, substantially less important than the rule of 3, which is about avoiding pitfalls that can lead to unexpected behaviors)?