No, you cannot have both a default and your own c-tor instance.
But there are two problems with this problem:
1 Inclusion of some pointers in some class with specific copy semantics
Example:
class A { public: private: int trivial1; int trivial2; ... SomePointer nontrivialMember; }; class SomePointer { public: SomePointer(const SomePointer&);
2 Enclose trivial parameters in some trivial structure
Example:
class A { public: A(const A& o) : data(o.data) {
I would always choose the first solution.
[UPDATE]
There is also a 3rd solution, very similar to my second, embedding your trivial part in a private inherited base class. I would prefer a 1st solution.
Piotrnycz
source share