Boost logo

Boost :

Subject: [boost] [lexical_cast] lexical_cast does not throw bad_lexical_cast
From: Carlos Rafael Giani (e0325834_at_[hidden])
Date: 2009-09-15 11:41:16


Hi,

I've noticed that sometimes lexical_cast does not throw
bad_lexical_cast. Instead, it throws
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_lexical_cast>
>'. A catch clause expecting a bad_lexical_cast fails here.

What seems confusing to me is that the lexical_cast docs do mention
"catch (bad_lexical_cast &)" as correct code
(http://www.boost.org/doc/libs/1_39_0/libs/conversion/lexical_cast.htm).
The solution that worked for me was to catch boost::exception instead.

Am I missing something here? I consulted the documentation, but still
have no answer. It also seems that I am not alone with this problem;

http://www.nabble.com/Porting-from-boost_1_33-to-boost_1_36-exception-td19708697.html
   and
http://archives.free.net.ph/message/20090715.183116.374b4777.en.html

at least indicate this for me.

regards,
   Carlos Rafael Giani


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk