This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12868] basic_filebuf::imbue fails too easily
- From: "peturr02 at ru dot is" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Nov 2003 08:57:50 -0000
- Subject: [Bug libstdc++/12868] basic_filebuf::imbue fails too easily
- References: <20031101081450.12868.peturr02@ru.is>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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().