0
請考慮下面的代碼:提取整個的std :: string從一個std :: stringstream的
std::stringstream test;
test << std::string("This is a test.");
std::string str;
test >> str;
std::cout << "\"" << str << "\"" << std::endl;
這僅輸出字符串 「This」,而不是 「這是一個測試。」
這是怎麼回事,我怎麼能得到整個字符串?
OK,應該已經看到了未來。我太簡化了我的例子。請看這裏: http://stackoverflow.com/questions/15350927/member-function-template-to-covert-a-stdstring-to-any-numeric-type-or-to-a-std – Dave 2013-03-12 00:04:36