|
Boost : |
Subject: Re: [boost] [lexical_cast] A non-throwing lexical cast? [Was: 5 Observations - My experience with the boost libraries]
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2010-03-25 21:25:30
Rene Rivera <grafikrobot <at> gmail.com> writes:
>
> Tom Brinkman wrote:
> > boost::lexical_cast_no_throw()
>
> Or..
>
> template <typename T, typename S>
> T lexical_cast(const S & arg, const T & error_default_value);
>
I've implemented later in my own version of lexical cast. In 99% of the time
this is exactly what I need: either convert string to number or take this
default value. Another good consequence is that I do not need template parameter
anymore.
Gennadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk