Boost logo

Boost :

From: Marc Mutz (marc_at_[hidden])
Date: 2007-11-06 12:18:52


On Saturday November 3 2007 07:55, Vladimir Batov wrote:
> Marc,
>
> Just uploaded v0.6 which supports building of two separate class
> hierarchies -- separately for interfaces and for implementations as
> described in GoF Pattern Bible for the Bridge pattern.
>
> The interface hierarchy is built as
>
> struct Base : public pimpl<Base>::pointer_semantics {...};
>
> struct Derived : public Base {...}
>
> etc.
>
> The implementation hierarchy is still hidden and is built as
>
> template<> struct pimpl<Base>::implementation {...};
>
> template<> struct pimpl<Derived>::implementation : public
> pimpl<Base>::implementation {...};
>
> etc.
>
> Marc, let me know if that looks right for your purpose as I myself have no
> use for deep inheritance trees to test them out.
<snip>

I've been more thinking about the attached scenario. I'm not sure it's worth
it, since the savings don't seem to be large compared to hand-written code,
and the need to spell out the forwarding Base(implementation*) is a bit ugly
(maybe that can be solved in C++0x?), but that should give you the idea.
Maybe someone better at template magic than I am can coerce this into a
workable thing. The need for verboseness in referring to
pimpl<Class>::implementation strikes me as a likely candidate for
improvement, e.g.

Thanks,
Marc

-- 
Marc Mutz - marc_at_[hidden], mutz_at_[hidden] - Klarälvdalens Datakonsult AB
Platform-independent software solutions - www.kdab.com info_at_[hidden]



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