最近習使用Boost庫,發現Boost庫對unicode字符集的支持好像采用和STL類似的方式(當然沒有完全證實)。STL是什么方式呢?就是在原有的ANSI類型上加上w表示這是unicode類型,如std::string對應std::wstring,std::cout對應std::wcout。Boost庫也是采用這種方式,據我已經測試有:
字符串格式化:boost::format對應boost::wformat
文件系統路徑:boost::filesystem::path對應boost::filesystem::wpath
下面是一個測試程序:
編譯環境是:WinXp + sp3,VS 2008 + sp1,unicode字符集
新聞熱點
疑難解答