Topic: Portable use of widen()


Author: kristian <kristian.spangsege@gmail.com>
Date: Sun, 2 Jan 2011 14:00:00 CST
Raw View
Is the following function portable according to C++03 given any
compliant stream locale and a compliant compiler:

void parenthesize(std::wostream &out, int i)
{
out << out.widen('(') << i << out.widen(')');

}

What I'm mostly concerned about is the use of widen() and the encoding
of the character literals passed as argument - given the fact that the
used characters are part of the basic source character set.


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]