Search code examples
c++inlinecopy-constructorc++03default-copy-constructor

Are undeclared copy-constructors automatically inline?


Are undeclared (auto-generated) copy constructors automatically marked as inline?

If so, and if I don't want them to be marked as inline, does that mean I have to define one manually and copy every single member I need by hand (assuming I'm not using C++11, so that there's no = default to take advantage of)?


Solution

  • They're treated as if they were declared inline (which doesn't necessarily mean that they will be inlined). And yes, in pre-C++11, the only way to prevent their being inline was to declare and define them manually, copying every member and every base class explicitly in the initializer list.