I frequently run into the problem, that I must extend a compiler generated copy constructor. Example:
class xyz;
class C
{
...
int a, b, c;
std:
the moment you define your own copy ctor, the compiler does not bother generating one for you. Unfortunately this means you have to do all the leg work yourself! You could group the members into some sort of impl_ structure within your class, and then rely on the copy ctor for that.
for example:
class xyz;
class C
{
struct impl_
{
int a, b, c;
std::set mySet;
xyz *some_private_ptr;
};
impl_ data;
};
now in your copy ctor
C::C(const C &other) : data(other.data)
{
// specific stuff...
}