This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: std_sstream.h - patch
- To: libstdc++@sourceware.cygnus.com
- Subject: Re: std_sstream.h - patch
- From: Benjamin Kosnik <bkoz@cygnus.com>
- Date: Wed, 26 May 1999 20:37:27 -0700 (PDT)
> > 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