The codebase I’m working on was developed mostly pre-C++11. A lot of classes have a never-defined default constructor declared in the private section. I’m rather confident that in Modern C++, the Correct Way™ is to make them public and = delete
them. I “upgraded” classes to this countless times by now and it never lead to problems.
My question is rather: Why was that done at all? This answer said that a default constructor is only ever provided if there’s no constructor given by the user (I guess that’s not including = default
) and there’s no hint that it doesn’t apply to pre-C++11. Of course, there is a non-trivial constructor in all of my classes I’m talking about. So, is there a rationale for it that I am missing?