This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: [RFC] A stream buffer for wcin
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: "Nathan Myers" <ncm-nospam at cantrip dot org>,<libstdc++ at gcc dot gnu dot org>
- Date: Mon, 17 Feb 2003 15:45:20 -0000
- Subject: RE: [RFC] A stream buffer for wcin
Nathan Myers wrote:
> My impression of the suggested patch is that it involves calling
> underflow on every character, rather than buffering.
Yes, unless wcin somehow has access to stdin's internal buffer,
I don't see how this can be avoided for the case when
ios_base::sync_with_stdio(false) hasn't been called.
> If it is necessary for good performance to make wcin and wstdin
> each do a sync operation between switching between them, that seems
> a small price to pay.
I don't see how such a sync operation could be implemented, there
is no portable way to put back more than one character to stdin,
and I'm not aware of any way to get access to the conversion state.
However, if ios_base::sync_with_stdio(false) has been called,
there is no need to sync wcin with stdin. In that case a buffered
wfilebuf can be used for wcin.
Petur