Boost logo

Boost :

Subject: Re: [boost] [conversion] try_lexical_cast and 200$
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-12-12 09:11:13


2013/12/12 Krzysztof Czainski <1czajnik_at_[hidden]>
<...>

> >
> > * `try_lexical_cast` must be added or not? And if yes, what signature is
> > preffered:
> >
> > bool try_lexical_cast<Out, In>(Out&, const In&)
> > bool try_lexical_cast<Out, In>(const In&, Out&)
> > boost::optional<Out> try_lexical_cast<Out, In>(const In&)
> >
>
> 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>
);

-- 
Best regards,
Antony Polukhin

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