This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Q about ctype.narrow
- From: Jerry Quinn <jlquinn at optonline dot net>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sat, 22 Nov 2003 16:02:33 -0500
- Subject: Q about ctype.narrow
I'm looking at time_put optimization and struggling with what seems to
be an unbeatable requirement to call narrow every time time_put::put
runs. In particular, the standard says that for any char_type c in
the "source character set":
ctype<char_type>.widen(ctype<char_type>.narrow(c, 0)) == c
But it still seems to allow for another char_type c1 to be narrowed
and widened and end up with c. So for example:
ctype.narrow(c,0) == '%' and
ctype.narrow(c1,0) == '%'
even though ctype.widen('%') == c.
Is this allowed? In other words, what I want is to widen '%' and
other important chars and cache the result, then use those results in
time_put::put instead of narrowing all the time. But it seems the
standard won't let me.
Jerry Quinn