51# define CAST_UNICODE_H
60INLINE std::wstring
widen(
const std::string& str) {
61 std::wostringstream wstm;
62 const std::ctype< wchar_t >& ctfacet = std::use_facet< std::ctype< wchar_t > >(wstm.getloc());
64 for (
size_t i = 0; i < str.size(); ++i) {
65 wstm << ctfacet.widen(str[i]);
71INLINE std::string
narrow(
const std::wstring& str) {
72 std::ostringstream stm;
73 const std::ctype< char >& ctfacet = std::use_facet< std::ctype< char > >(stm.getloc());
75 for (std::size_t i = 0; i < str.size(); ++i) {
76 stm << ctfacet.narrow(str[i], 0);
Unicode helper functions.
INLINE std::wstring widen(const std::string &str)
Cast a std::string into a std::wstring.
INLINE std::string narrow(const std::wstring &str)
Cast a std::wstring into a std::string.