Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-04-18 09:51:37

I've just updated my project to use boost 1.30 and also gcc 3.2 and see
exception which reads:

   bad lexical cast: source type value could not be interpreted as target,
   Target=i, Source=Ss

The simple reproduction recipe is:

    #include <boost/lexical_cast.hpp>
    #include <string>

   int main()
       boost::lexical_cast<int>(std::string(" 0"));

Note the space in string. The exception does not occur with gcc 2.95, but only
with 3.2. I wonder if this should/can be fixed? Personally, I'd expect this
code to work.

And a related note: the exception's what() above is not quite helpfull. Is it
possible to output the stringstream content (if source -> stringstream
conversion was successfull?)

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at