Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-05 19:29:29


"Daryle Walker" <darylew_at_[hidden]> wrote in message
news:BD6112DB.EF56%darylew_at_hotmail.com...
> On 9/2/04 12:40 PM, "Jonathan Turkanis" <technews_at_[hidden]> wrote:
>
> [SNIP]
> > Note that it is fairly common for a stream to derive privately from
> > basic_streambuf; with the current implementation, testing such a stream
using
> > is_streambuf causes a compiler error.
>
> I think that using private inheritance as an quick & dirty containment
> strategy is a bad idea in general. (Which includes this usage.) All the
> member names of the contained object's class get injected as member names of
> the container object's class. Also, the container object's member functions
> (and friends) still see the relationship as IS-A, even though it's supposed
> to be HAS-A, so inappropriate conversions and/or uses won't be checked.

The problem is that you get a compiler error just for asking the question: is T
a streambuf? T may be written by someone else; you shouldn't have to assume
anything about it.

Jonathan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net