Boost logo

Boost :

Subject: Re: [boost] [review] string convert
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2011-05-03 11:20:07


Vladimir Batov wrote:
>> Gordon Woodhull <gordon <at> woodhull.com> writes:
>> ..
>> Here's again the alternate "simpler" syntax which I put in my original
>> review, which I think must have
>> gotten buried from typing too much. :-/
>>
>> optional<int> i = string_convert<int, dont_throw>(s);
>> // or string_convert<int>(s, _throw=false) if
>> that's impossible
>> int i = string_convert<int>(s, manip_ = std::hex);
>
> Apologies if you expected me to reply to something that I missed. I believe the
> functionality you are proposing is available via
>
> convert<int>::result res = convert<int>::from(s);
>
> The deployment of boost::optional might be quite appropriate in this particular
> case. However, I fee that the deployment of dedicated convert::result is better
> suited across (uniformity) all library uses. I'd probably like to hear more what
> clear advantages your proposed interface offers over the existing one.

In my mind boost::optional 'is' the way to represent optional value
types, and this promotes "uniformity" non only across used of this
library, but all boost libraries.

Jeff


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