id summary reporter owner description type status milestone component version severity resolution keywords cc 7532 lexical_cast fails on complex number with spaces J. J. Ramsey Antony Polukhin "Here's the test code that shows the problem: {{{ #include #include #include #include typedef std::complex Complex; int main() { std::string goodComplex(""(1,2)""), badComplex(""(1, 2)""); try { Complex foo = boost::lexical_cast(goodComplex); std::cout << ""goodComplex = "" << foo << ""\n""; } catch (boost::bad_lexical_cast const & e) { std::cerr << ""goodComplex failed: "" << e.what() << ""\n""; } try { Complex foo = boost::lexical_cast(badComplex); std::cout << ""badComplex = "" << foo << ""\n""; } catch (boost::bad_lexical_cast const & e) { std::cerr << ""badComplex failed: ""<< e.what() << ""\n""; } { /* Using a stringstream works, though. */ Complex foo; std::istringstream tmpStream(badComplex); tmpStream >> foo; std::cout << ""badComplex printed with stringstream = "" << foo << ""\n""; } } }}} On my machine, with g++ 4.1.2, I get the following result: {{{ goodComplex = (1,2) badComplex failed: bad lexical cast: source type value could not be interpreted as target badComplex printed with stringstream = (1,2) }}} For some reason, lexical_cast chokes on the space after the comma, but the stringstream has no problem. " Bugs closed To Be Determined lexical_cast Boost 1.50.0 Problem wontfix