Portable use of widen()

K

kristian

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top