Document Number: WG21/N0858 = X3J16/96-0040 Date: 30 Jan 1996 Project: C++ Standard Library Reply to: Nathan Myers Clarify ctype<> Members widen() and narrow() -------------------------------------------- The question arises frequently when to use the ctype<> member functions widen() and narrow(), and when to use the codecvt<> facet. The distinction is actually quite simple: the codecvt<> facets of a locale convert between any two encodings specified for a locale. The codecvt facet might convert between (e.g.) extended EBCDIC and Unicode. The ctype facet members widen() and narrow convert only between the character type charT and the encoding supported by your compiler. In other words, the appropriate argument values for codecvt<> members tend to arrive via an input device, whereas arguments for ctype<>::widen are character literals. This distinction does not appear to be clear in the draft, but should be. Proposed Resolution ------------------- In [lib.locale.ctype] (22.2.1.1), add a paragraph: 3 The argument to members widen(), and the result of members narrow() have the encoding of the native execution character set, identical to that of character and string literals. [Example: an appropriate use of widen would be widen('0') to produce the character representing the digit zero in a locale's character encoding. -- end example ]