Using the stream

typedef logostream<char> clogostream;
typedef logostream<wchar_t> wlogostream;

...

int main()
{
  clogostream;out( std::cout );
  out << "31 hexadecimal: " << std::hex << 31 << std::endl;
  return 0;
}