PR 3983, basic_istringstream<unsigned char> fails
Nathan Myers
ncm-nospam@cantrip.org
Mon Feb 25 19:27:00 GMT 2002
On Mon, Feb 25, 2002 at 11:10:47AM -0800, Benjamin Kosnik wrote:
>
> This issue keeps resurfacing in various forms. I should probably write
> something up and put it in the 27_io FAQ.
>
> Here's the first discussion:
> 2001-12-03
> _M_fill initialization in basic_ios::init
> http://gcc.gnu.org/ml/libstdc++/2001-12/msg00021.html
> http://gcc.gnu.org/ml/libstdc++/2001-12/msg00106.html
> http://gcc.gnu.org/ml/libstdc++/2001-12/msg00113.html
> http://gcc.gnu.org/ml/libstdc++/2001-12/msg00120.html
> ...
> // NB: The 27.4.4.1 Postconditions Table only specifies
> // requirements after basic_ios::init() has been called. As part
> // of this, fill() must return widen(' '), which needs an imbued
> // ctype facet of char_type to return without throwing an
> // exception. This is not a required facet, so streams with
> // char_type != [char, wchar_t] will not have it by
> // default. However, because fill()'s signature is const, this
> // data member cannot be lazily initialized. Thus, thoughts of
> // using a non-const helper function in ostream inserters is
> // really besides the point.
> _M_fill = this->widen(' ');
I don't understand this. It doesn't matter that fill() is const.
The _M_fill member (as any other data member) can be mutable if
declaring it so enables an optimization.
Nathan Myers
ncm at cantrip dot org
More information about the Libstdc++
mailing list