How to convert string to int (or int to string)

Have I already told that Boost is incredibly useful thing? For example, to easily convert number into the string, you can use lexical_cast like:

boost::lexical_cast<string>(10);

Of course, it's possible to convert the string back to the int using the same library:

boost::lexical_cast<int>("10");

The same for most basic types conversions like string to long or float.

As far as I know it's default implementation is not extremelly efficient. But the syntax is very handy when you just have to code some conversion rapidly.

And it is possible to add user-defined conversions.