From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2007-10-07 17:00:50
>For what I can understand you have one class 'b' in B library that you
>want to use with alghoritms of _both_ A and B library the pattern is:
>1 - get the class 'a' subclassing 'b'; class a : b
>2 - add to 'a' interfaces to deal with algorithms of library A
>3 - implement that interfaces using methods of 'b' and/or functions of
>library B acting on 'b'
>4 - use 'a' with library A using the above interface
>5 - use 'a' with library B because base class of 'a' is a 'b'
>Is this interpretation correct ?
Yes, though I would add that the intention is to use it with classes b1
through bN of libraries B1 through BN so that the effort of making the
library generic is worthwhile. Class a inherits from each of the
classes b1 through bN through its template parameter. In this way it is
as useful as making class a the common base class of b1 through bN, but
is not intrusive and leaves the code of libraries B1 through BN
untouched. This inheriting one class from many allows us to unify the
disparate semantics of many different types that are conceptually
similar. I have found it very useful in my day to day work since I end
up being the person integrating my library into existing code bases in
addition to authoring it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk