[英]Is there alternative for front() in c++ 03?
string utf2oem( string const & in_str ) {
int n = MultiByteToWideChar( CP_UTF8, 0, in_str.data(), in_str.size(), NULL, 0 );
if( n == 0 )
return in_str;
wstring tmp;
tmp.resize( n );
int ret = MultiByteToWideChar(CP_UTF8, 0, in_str.data(), in_str.size(), &tmp.front(), tmp.size() );
if( ret == 0 )
return in_str;
string out_str;
out_str.resize( n );
ret = WideCharToMultiByte(CP_OEMCP, 0, tmp.data(), n, &out_str.front(), n, NULL, NULL);
return( ret == 0 ? in_str : out_str );
}
我嘗試使用此功能,但出現錯誤: error C2039: 'front' : is not a member of 'std::basic_string<_Elem,_Traits,_Ax>'
那么我可以在帶有Boost 1.38的Visual C ++ 2008中使用代替front()的東西嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.