Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-06-20 07:28:34


On Wednesday 20 June 2001 01:02, you wrote:
> --- In boost_at_y..., Douglas Gregor <gregod_at_c...> wrote:
> > I have written a small library that performs base class
> > injection, which essentially allows the user to take a
> > class A and "inject' it as a base class of some other
> > class R. The injection is done without modifying R's source
> > code, so it is a powerful method of separating concerns. The
> > following example is paraphrased from the paper at:
> >
> > http://www.cs.rpi.edu/~gregod/papers/base_class_injection.ps
>
> Is there a PDF of this paper. Reading PostScript directly is
> somewhat of a pain for non-UNIX users.

I remembered to use zip to help out the non-UNIX users, but never thought
twice about using Postscript :)

The PDF is now available at:
http://www.cs.rpi.edu/~gregod/papers/base_class_injection.pdf

> > which describes the concept much more cleanly. The library
> > itself is located at:
> >
> > http://www.cs.rpi.edu/~gregod/libraries/injection.zip
>
> [SNIP example]
>
> > Is there interest for this technique within Boost?
>
> I downloaded the *.ZIP file, and this looks kewl. I haven't tried
> compiling the code yet. We should add it to Boost, if there's no
> problems with its interactions with Standard C++.
>
> Daryle Walker
> [posting through web interface]

It's legal C++. Since the 'receiver' classes (those that are able to receive
injections) are template classes that derive from the injection::bases
template (which is dependent on all of the template parameters), injections
can be made up until the point of instantiation. The 'Tag' template parameter
keeps our full specializations as partial specializations so instantiation is
performed as late as is possible.

        Doug


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