This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: std_sstream.h - patch



>  > 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]