Boost logo

Boost :

Subject: Re: [boost] [conversion] try_lexical_cast and 200$
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2013-12-12 12:35:39


On Thu, Dec 12, 2013 at 6:11 AM, Antony Polukhin <antoshkka_at_[hidden]>wrote:

> 2013/12/12 Krzysztof Czainski <1czajnik_at_[hidden]>
> > How about:
> > boost::optional<Out> lexical_cast<Out, In>(const In&, std::nothrow_t)
> >
>
> This will break one of the use cases. For example there'll be an ambiguity
> beacause of function overloads.:
>
> std::transform(
> values.begin(), values.end(),
> ret.begin(),
> &boost::lexical_cast<std::string, int>
> );

You can still have that interface, not break existing code, and make it
easy to do similar stuff with the nothrow version. A little hackish, but:

http://codepaste.net/py5ot3

-- 
-Matt Calabrese

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