This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]