0
我遇到了wstringstream的問題。當我這樣做C++ wstringstream << NULL
std::wstringstream ss;
wchar_t* str = NULL;
ss << str;
應用程序崩潰,錯誤
Unhandled exception at 0x53e347af (msvcr100d.dll) in stringstr.exe: 0xC0000005: Access violation reading location 0x00000000.
例如這工作好:
ss << NULL;
wchar_t* str = L"smth";
ss << &str;
並不總是海峽具有價值,它可能是NULL有時,當它是NULL我想把0流入。如何解決它?
AHHHHH,我試圖'SS <<(STR 0:?STR);',它不能正常工作 – user1112008
@ user1112008 :隱式條件運算符返回類型是它的兩個表達式的通用類型,所以在你的情況下它仍然會返回一個空的'wchar_t'指針。 –
還有一個問題,如果我們使用模板會怎麼樣? 'template std :: string realToString(type real)'我們檢查'real'是不是NULL? –
user1112008