Q about ctype.narrow

Martin Sebor sebor@roguewave.com
Wed Nov 26 16:27:00 GMT 2003


Pétur Runólfsson wrote:

...
> No. There is a special exception in 22.1.1 p7 (modified by DR 360)
> that allows users of locale to cache return values. Note that it
> says "facet object installed in the same locale" so in:
> 
> ostream os(...);
> os.widen('\n'); // Must call ctype::do_widen(char).
> os.widen('\n'); // May use cached value.
> os.imbue(os.getloc().combine<numpunct<char> >(locale("")));
> // Same ctype facet, but different locale => must call
> // ctype::do_widen again.
> os.widen('\n'); 

I can see how you could interpret the text that way but it was not
the intent of the resolution to require the behavior you describe
above (and I don't see any point in requiring it). Perhaps it
should have been worded better -- something like:

     In successive calls with the same arguments to a locale facet
     member function on the same facet object, the returned result
     shall be identical.

Martin




More information about the Libstdc++ mailing list