[Bug libstdc++/12868] basic_filebuf::imbue fails too easily

peturr02 at ru dot is gcc-bugzilla@gcc.gnu.org
Tue Nov 4 08:57:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12868



------- Additional Comments From peturr02 at ru dot is  2003-11-04 08:57 -------
> The strict conditions on filebuf::imbue are a result of not being able to
> deal with possible re-conversion at the time filebuf::imbue is called.
> (See the Yikes comment in the code.)

There is no problem for output; just call overflow() to flush the buffer
with the old locale, then switch to the new locale. For input, I think
_M_ext_buf is the key. There is no need to "reconstruct the original
contents of the file", because the original contents are stored in
_M_ext_buf. The current position can be found with codecvt::length(), as
in seekoff().



More information about the Gcc-bugs mailing list