When I discovered boost::lexical_cast I thought to myself ‘why didn’t I know about this sooner!’ – I hated having to write code like
stringstream ss; ss << anIntVal; mystring = ss.str();
Now I write
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.
What boost functions do you use most / would hate not to have?
Probably the most used part of boost for me is boost::shared_ptr.