std_sstream.h - patch
Benjamin Kosnik
bkoz@cygnus.com
Tue Jun 1 12:43:00 GMT 1999
> > I checked this in, thanks. I saved the dynamic_cast: it does not harm the
> > generated code, is legal c++, and clarifies that a conversion from derived
> > to base is happening.
>
> I would think that should be a static_cast, then.
5.2.7 p 5
assuming dynamic_cast<T>(v)
If T is pointer to cv1 B and v has type pointer to cv2 D such that B is a
base class of D, the result is a pointer to the unique B sub-object of D
pointed to by v.
In this case,
dynamic_cast<__streambuf_type*> (this);
this == stringbuf type (derived from streambuf)
__streambuf_type == streambuf
means
dynamic_cast<B*>(D*)
No?
(if it was the inverse, I'd use the static_cast)
-Benjamin
More information about the Libstdc++
mailing list