This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] Default constructed stringbufs and stringstreams
On Wed, Sep 29, 2004 at 03:55:46PM +0200, Paolo Carlini wrote:
> diff -prN libstdc++-v3-orig/include/std/std_sstream.h libstdc++-v3/include/std/std_sstream.h
> *** libstdc++-v3-orig/include/std/std_sstream.h Sun May 23 01:46:33 2004
> --- libstdc++-v3/include/std/std_sstream.h Wed Sep 29 14:19:46 2004
> *************** namespace std
> *** 111,118 ****
> */
> explicit
> basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
> ! : __streambuf_type(), _M_mode(), _M_string()
> ! { _M_stringbuf_init(__mode); }
>
> /**
> * @brief Starts with an existing string buffer.
> --- 111,118 ----
> */
> explicit
> basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
> ! : __streambuf_type(), _M_mode(__mode), _M_string()
> ! { }
>
> /**
> * @brief Starts with an existing string buffer.
Hi Paolo,
I particularly like this bit, setting _M_mode in the ctor init list.
Now that it's set there, doesn't that make the openmode parameter to
_M_stringbuf_init() redundant ?
AFAICT the only call to _M_stringbuf_init() that didn't pass the
existing _M_mode value (and therefore self-assigning _M_mode) was the
one you're about to remove.
If this is so derived classes can alter the mode by calling the
proteced _M_stringbuf_init() then should that be documented ?
(Not changing the ABI is an even better reason of course, but for v7
branch?)
I was going to propose that you set _M_mode in the init list and not in
_M_stringbuf_init() - but this patch beat me to it as I want to solve my
missing template instantiations and improve docs/html/install.html first.
jon
--
"Give a man fire, he'll be warm for a few hours.
Set a man on fire, he'll be warm for the rest of his life."
- anonymous git