Portable use of widen()

Discussion in 'C++' started by kristian, Jan 2, 2011.

  1. kristian

    kristian Guest

    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.
    kristian, Jan 2, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eli Bendersky
    Replies:
    1
    Views:
    1,161
    Mike Treseler
    Mar 1, 2006
  2. Lian
    Replies:
    2
    Views:
    2,427
    Karl Groves
    May 31, 2004
  3. Replies:
    7
    Views:
    916
  4. Jeffrey Walton
    Replies:
    10
    Views:
    938
    Mathias Gaunard
    Nov 26, 2006
  5. b1caez02
    Replies:
    2
    Views:
    326
    shadowman
    Mar 20, 2007
Loading...

Share This Page