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
42 = std::use_facet< std::ctype<
wchar_t > >(wstm.getloc());
44 for (size_t i = 0; i < str.size(); ++i) {
45 wstm << ctfacet.widen(str[i]);
51 INLINE std::string narrow(
const std::wstring& str) {
52 std::ostringstream stm;
53 const std::ctype<
char >& ctfacet
54 = std::use_facet< std::ctype<
char > >(stm.getloc());
56 for (std::size_t i = 0; i < str.size(); ++i) {
57 stm << ctfacet.narrow(str[i], 0);