|
Boost : |
From: Peter Kümmel (syntheticpp_at_[hidden])
Date: 2006-01-19 15:57:35
Hello,
maybe you are interested in a other Pimpl implementation
which differs from pimpl_ptr in some points.
Here a short overview:
- you could declare a pimpl or inherit a pimpl (usage: pimpl->foo())
- you could also declare/inherit a rimpl (reference to implementation, usage rimpl.foo())
- you could use different smart pointer as pimpl which is adjusted by a policy,
it's a little bit like a templated pimpl_ptr
- there are more convenient typedefs
- no lazy creation
Example headers:
------------------------
//declare a Pimpl:
class A
{
public:
A();
void foo();
private:
Pimpl<A>::Type d;
};
----------------------
//inherit a Pimpl:
class B : private Pimpl<B>::Owner
{
public:
B();
void foo();
};
------------------------
//declare a Rimpl
class C
{
public:
C();
void foo();
private:
Rimpl<C>::Init rinit;
Rimpl<C>::Type d;
};
------------------------
//inherit a Rimpl:
class D : private Rimpl<D>::Owner
{
public:
D();
void foo();
};
The code is at the moment in the loki-lib cvs at sourceforge.
If you are interested I could also send the files.
Cheers,
Peter
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk