代码之家  ›  专栏  ›  技术社区  ›  Ferruccio

Boost.format和宽字符

  •  22
  • Ferruccio  · 技术社区  · 16 年前

    有没有办法让boost.format使用并返回宽(Unicode)字符串?

    我希望能够做到以下几点:

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

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

    1 回复  |  直到 16 年前
        1
  •  30
  •   Johannes Schaub - litb    16 年前

    format_fwd.hpp 包含此类型定义:

    typedef basic_format<wchar_t >  wformat;
    

    我想这会让你开始的。这在这里起作用:

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

    还有 boost::str 使用 wformat