class DPrivate{\
public:DPrivate();DPrivate(const DPrivate&);~DPrivate();\
DPrivate&operator=(const DPrivate&);\
- Private*operator->()const{return d;}\
+ const Private*operator->()const{return d;}\
+ Private*operator->(){return d;}\
+ DPrivate clone()const;\
private:Private*d;\
}; \
DPrivate dp;
Class::DPrivate::DPrivate(){d=new Class::Private;}\
Class::DPrivate::DPrivate(const Class::DPrivate&dp){d=new Class::Private(*(dp.d));}\
Class::DPrivate::~DPrivate(){delete d;}\
+ Class::DPrivate Class::DPrivate::clone()const{DPrivate r;*(r.d)=*d;return r;}\
Class::DPrivate& Class::DPrivate::operator=(const Class::DPrivate&dp)\
{*d=*(dp.d);return *this;}
Class::DPrivate::DPrivate(){d=new Class::Private;}\
Class::DPrivate::DPrivate(const DPrivate&dp){d=dp.d;d->attach();}\
Class::DPrivate::~DPrivate(){d->detach();}\
+ Class::DPrivate Class::DPrivate::clone()const{DPrivate r;*(r.d)=*d;return r;}\
Class::DPrivate& Class::DPrivate::operator=(const DPrivate&dp)\
{d->detach();d=dp.d;d->attach();return *this;}