Vincent van Ravesteijn wrote: > Op 12-10-2015 om 4:17 schreef Scott Kostyshak: >> On Sun, Oct 11, 2015 at 11:20:15AM +0200, Georg Baum wrote: >>> commit cea2d71e641e6a4023128a367d1cd5a593ed1706 >>> Author: Georg Baum <b...@lyx.org> >>> Date: Sun Oct 11 11:16:09 2015 +0200 >>> >>> Comply with rule-of-three >>> >>> The rule-of-three says that if any of virtual destructor, copy >>> constructor or assignment operator needs to be manually >>> implemented, then all three should be implemented. Otherwise you >>> can get subtle bugs which can be difficult to find. In the changed >>> classes, changing a copy-construction to an assignment would have >>> had surprising effects. Now they all behave consistently. > >> Is there any automatic check of the rule-of-three (e.g. by cppcheck or >> Coverity)?
I don't think so. I found these while working on bug 7404. > What about declaring the unimplemented 'others' as private, but leaving > them unimplemented (if possible) ? This prevents adding unused code to > the codebase. I did that for the cases where the additional code would have been too complicated. For the trivial cases I liked the symmetry of the two implementations, but don't have a strong opinion, so if others prefer to disable the assigment operators instead I'll change it. Georg