Just stumbled on the same issue. In my case, I am using VS2010.
It is clear that VS2010 will never be updated in order to fully implement C ++ 11, use VS2015 if you need better compliance with the standard (what I do when I can). But for some (old) projects, I still have to use VS2010.
An approach that works in many cases (for me) is to use a private function with all the common initialization code. Example:
class A { private: void Inidialise() { } public: A() { Initialise(); } A(bool a) { Initialise(); } A(int b) { Initialise(); } }
It does not solve all the "problems" and does not prevent all cases of code duplication, but it is of great importance.
Papaathome
source share