最佳答案
当我发现 boost::lexical_cast
的时候,我对自己说: “为什么我不早点知道这个!”我讨厌写代码
stringstream ss;
ss << anIntVal;
mystring = ss.str();
现在我写作
mystring = boost::lexical_cast<string>(anIntVal);
Yesterday, on stackoverflow, I came across boost split (another gem that will save me writing code).
string stringtobesplit = "AA/BB-CC")
vector<string> tokens;
boost::split(tokens, stringtobesplit, boost::is_any_of("/-"));
// tokens now holds 3 items: AA BB CC
I am going to start looking through boost documentation looking for other functions that I will be able to use regularly, but I feel that it will be very easy to miss things.
你最常用的/最讨厌没有的增强功能是什么?