Boost logo

Boost :

Subject: Re: [boost] [conversion] try_lexical_cast and 200$
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-12-13 07:24:01


On Friday 13 December 2013 15:51:20 Antony Polukhin wrote:
> Thank you all for giving comments and ideas!
>
> Looks like it'll be `bool try_lexical_convert<Out, In>(const In&, Out&)`:
>
> * boost::optional version adds additional dependency + boost::optional
> does not support move semantics well, so it'll be hard to implement a very
> efficient try_lexical_convert with current boost::optional
> * returning bool looks like the simplest solution that can be easily
> adopted by user
> * output parameter is at the last position (like it is done in many
> Standard Library methods)
> * name contains "convert" instead of "cast", because function does not look
> like a cast

May I suggest that the first argument is an rvalue reference, and the function
performs perfect forwarding to the operator<<? This is of course when rvalue
references are available.


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