15 Nov
2005
15 Nov
'05
11:53 a.m.
Sean Rohead wrote:
std::string narrow(std::wstring source) { std::string result(source.size(), char(0)); typedef std::ctype
ctype_t; const ctype_t& ct = std::use_facet (std::locale()); ct.narrow(source.data(), source.data() + source.size(), '\u00B6', &(*result.begin())); return result; }
Not that this is likely to have anything to do with the error, but you mustn't use string::begin() like that. The sequence of characters is not guaranteed to be an array. If you want that guarantee, use a vector instead. Ben.