views:

1127

answers:

1

Is there a way to get boost.format to use and return wide (Unicode) character strings?

I'd like to be able to do things like:

wcout << boost::format(L"...") % ...

and

wstring s = boost::str(boost::format(L"...") % ...)

Is this possible?

+9  A: 

format_fwd.hpp contains this typedef:

typedef basic_format<wchar_t >  wformat;

I think this will get you started. This works here:

std::wcout << boost::wformat(L"...") % ...

Also the boost::str works using wformat.

Johannes Schaub - litb
Yep. I use boost::wformat all the time.
Rob
I'm surprised how easy to use boost::format is. didn't know you can print into a string that way. i certainly have to have a look at it
Johannes Schaub - litb