On Wed, 2004-09-01 at 08:12 +0100, Max Bowsher wrote:Robert Collins wrote:
Have you heard of the 'rule of 3' ?
No. Apparently I need to do some reading.
http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.9
"A class with any of {destructor, assignment operator, copy constructor} generally needs all 3"
After that, and further googling, I fully agree with the rule of 3.
However, it appears to me that PackageSpecification needs none of these.
copy-constructor: Was private, now gone. destructor: Is currently present, but a no-op. assignment operator: Is present and bizarre...
...in that it only assigns the name, not the operator or version!
This seems like a bug to me - and the only reason we haven't bumped into it before, is because we haven't begun to use versioned dependencies.
So, unless there's something I'm not seeing, the destructor and operator= can be removed too.
Max.