[lexical_cast] converting "true" to bool fails - why?

30 Jan
2007
30 Jan
'07
10:05 a.m.
Hi! The following code snippet prints "failure!" during execution: #include <boost/lexical_cast.hpp> #include <iostream> int main() { try { bool test = boost::lexical_cast<bool>("true"); } catch (boost::bad_lexical_cast const &) { std::cerr << "failure!\n"; } } IIRC there was some way to achieve a conversion using the correct locale and stringstreams. Is there a way to obtain a successful conversion with lexical_cast, too? Markus
6715
Age (days ago)
6715
Last active (days ago)
0 comments
1 participants
participants (1)
-
Markus Werle