I've seen some answers to other boost::lexical_cast
questions that assert the following is possible:
bool b = boost::lexical_cast< bool >("true");
This doesn't work for me with g++ 4.4.3 boost 1.43. (Maybe it's true that it works on a platform where std::boolalpha
is set by default)
This is a nice solution to the string to bool problem but it lacks input validation that boost::lexical_cast provides.