From: Asger Mangaard (tmb_at_[hidden])
Date: 2005-09-27 10:12:38
> Could you be more specific as to what functionality such a library would
> supply? If you already have an implementation then an example of it's use
> would be interesting.
> It is my understanding that the pimpl idiom is fairly simple yet also
> specific. I currently implement it like this:
> In the .hpp
> class foo
> class pimpl_t;
> pimpl_t* pimpl;
> in the .cpp
> #incldue "foo.hpp"
> class foo::pimpl_t
> //private data
> I don't readily see how this could be abstracted, so an example would help
> me to see what you are proposing more clearly.
The implementation is simple indeed. However, I find myself using it all
The only thing my library does is to initialize the forward declared
class, using heap or static memory through policies. Also, provides an
easy way of accessing the data.
boost::pimpl<struct CMyData> m_MyData;
/// Data access
m_MyData->m_Integer = 2341;
The CMyData will be initialized the first time its data members are accessed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk