29 #ifndef CAST_UNICODE_H 30 #define CAST_UNICODE_H 37 #include <agrum/tools/core/cast_unicode.h> 39 INLINE std::wstring widen(
const std::string& str) {
40 std::wostringstream wstm;
41 const std::ctype<
wchar_t >& ctfacet = std::use_facet< std::ctype<
wchar_t > >(wstm.getloc());
43 for (size_t i = 0; i < str.size(); ++i) {
44 wstm << ctfacet.widen(str[i]);
50 INLINE std::string narrow(
const std::wstring& str) {
51 std::ostringstream stm;
52 const std::ctype<
char >& ctfacet = std::use_facet< std::ctype<
char > >(stm.getloc());
54 for (std::size_t i = 0; i < str.size(); ++i) {
55 stm << ctfacet.narrow(str[i], 0);