"Daryle Walker"
On 9/2/04 12:40 PM, "Jonathan Turkanis"
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