Alex Rivera | Logout

Most used parts of Boost

Asked 2008-11-28T14:36:29.897
118

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?

Edit
Report

3 Answers

51

BOOST_FOREACH makes life worthwhile again.

(Why has nobody mentioned this? The question was asked 8 months ago!)

answered 2009-08-07T17:19:51.077
3

What I use the most is now available in the TR1:

  • shared pointers
  • array class

Now I also use pool classes and some other more specific things.

You understand now that Boost is meant to be useful to most programmers, that's why it's the test bed for the future standard library.

answered 2008-11-28T14:41:04.083
1

Talking about boost::lexical_cast, why isn't something like 'format' a static member in the std::string library?
Almost all gui libs have something like CString::Format("%i") or QString::Number("%i") which return an initialised string.

answered 2008-11-28T15:23:34.463

Your Answer