Boost logo

Boost :

Subject: [boost] [lexical_cast] A non-throwing lexical cast? [Was: 5 Observations - My experience with the boost libraries]
From: pete_at_[hidden]
Date: 2010-03-24 05:31:24

On Wed 24/03/10 03:40 , Jonathan Franklin <franklin.jonathan_at_[hidden]> wrote:

> On Tue, Mar 23, 2010 at 9:31 PM, Tom Brinkman wrote:
> > ... All I'm saying is that in the real world, most
> > projects are mixed C/C++ and that the needs of both communities
> need
> > to be addressed if boost is going to remain relevent.

> For the sake of not arguing, let's assume that your assertion is
> true.
> Let's hear your *actionable* proposal for improving boost. E.g.
> show
> us the better interface for <insert Boost library here>

Taking an example from way back at the start othis thread, in my personal experience a non-throwing version of lexical_cast<> would be very nice.

If I look at the cases where I pass user data through my libraries into boost libraries without some pre-validation, there are very few, and naturally these are the cases where the validation would as difficult as the "parse":

- boost::spirit::phrase_parse - Just returns a true/false, and I build a nice context-driven error message myself if necessary.
- boost::lexical_cast - throws. Almost always needs to be caught and re-thrown.

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