当我发现时,boost::lexical_cast
我心想“为什么我不早点知道这件事!” - 我讨厌不得不编写类似的代码
stringstream ss;
ss << anIntVal;
mystring = ss.str();
现在我写
mystring = boost::lexical_cast<string>(anIntVal);
昨天,在 stackoverflow 上,我遇到了 boost split(另一个可以帮助我编写代码的 gem)。
string stringtobesplit = "AA/BB-CC")
vector<string> tokens;
boost::split(tokens, stringtobesplit, boost::is_any_of("/-"));
// tokens now holds 3 items: AA BB CC
我将开始查看 boost 文档,寻找我可以经常使用的其他功能,但我觉得很容易错过一些东西。
您最常使用/不想拥有哪些增强功能?