Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-08-02 17:51:50


David Abrahams wrote:
> "Paul Mensonides" <pmenso57_at_[hidden]> writes:
>
> > Aleksey Gurtovoy wrote:
> >> David Abrahams wrote:
> >> > Here's an example I just cooked up of using the PP lib to solve a
> >> > classic C++ OO problem: repeated boilerplate in the definition of
> >> > Pimpl classes.
> >>
> >> There is another variation of the idiom, sometimes called
> >> "hidden state", which doesn't have the shortcoming in the first place:
> >
> > Dave, do you still think this would be a good example to add to the
> > docs?
>
> Well, yeah. I don't understand how Aleksey's idiom accomplishes the
> same things as pimpl (yet).

I was talking about pimpl as described here -
http://www.gotw.ca/gotw/024.htm.

> I need to be able to plug in different
> runtime-polymorphic implementations behind the handle classes I'm
> defining.

Sounds like a job for an interface class + a factory function, unless your
objects need to be passed by value. In any case, IMO the latter one is more
correctly described as "handle/body".

Aleksey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk