我正在尋找一種獲取無符號字符串的方法。 所以我在此Strings of unsigned chars無法建立字符串的結構
跌跌撞撞因此,答案如下:創建一個新的typedef:
typedef std::basic_string<unsigned char> ustring;
的事情是,我不能用這個來構建。當我嘗試:
char *p = "123123";
auto s = ustring(p);
我得到以下錯誤:
no instance of constructor "std::basic_string<_Elem, _Traits,
_Alloc>::basic_string [with _Elem=unsigned char,
_Traits=std::char_traits<unsigned char>, _Alloc=std::allocator<unsigned
char>]" matches the argument list
可有人請闡明這個問題一些輕?
在此先感謝!
如果您丟棄了C標籤並用內嵌文本替換了您的圖像,那麼這將是一個不錯的問題。 – Bathsheba
謝謝,現在這是一個很好的問題。有一個upvote。 – Bathsheba