|
|
|
|
|
by guenthert
828 days ago
|
|
To expand on this, "In naturally written C++ code, changing the private members of a class requires recompilation of the code using the class." -- uh, the Pimpl pattern has been idiomatic C++ for a long, long time (http://www.gotw.ca/gotw/024.htm). |
|
Complextype m;
which has the fewest tokens, is the easiest to read, and doesn't require extra memory/lifetime management or library types that didn't even exist in the standard library for the first decades of the language (i.e. std::unique_ptr) so certainly weren't the originally intended way to declare members but are workarounds for a problem in the original language.
Of course, the solution to this (and some of the other problems discussed here) in other languages is often make everything a heap pointer under the hood, and there are good reasons not to do that!