
or boost::lexical_cast_no_throw() On Thu, Mar 25, 2010 at 11:57 AM, Kim Barrett <kab.conundrums@verizon.net> wrote:
On Mar 25, 2010, at 2:17 PM, Bruno Santos wrote:
boost::lexical_cast - throws. Almost always needs to be caught and re-thrown. Why? Is it because you need to do some cleanup? Do you known what RAII is?
Exception translation, i.e. "re-thrown" as in "thrown in a different form". boost::bad_lexical_cast is not derived from my_project::invalid_user_input o or whatever. This happens a lot with boost::lexical_cast.
What about boost::system::error_code as the second parameter for the non throwing version? And it does not suffer from the return error code problem. Just take a look at boost::filesystem and boost::asio.
The point was that the present interface for boost::lexical_cast often leads to try/catch blocks.
I like this suggestion of a second error_code argument a lot.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost