Subject: Re: [boost] [review] string convert
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2011-05-04 11:00:12
Gordon Woodhull wrote:
> On May 4, 2011, at 10:33 AM, Stewart, Robert wrote:
>> The only other one I haven't commented on is the pair<bool,int> version. It shouldn't require a second argument. All of the variations that take a single argument should have a version that takes a second in case there's no default construction or zero-initialization possible. That aside, the pair version leads to much less readable code, not least because the semantics of pair<int,bool> are less obvious than those of optional<int>.
> We're going in circles because it's hard to keep all the use-cases in one's head at one time.
> Something is needed here, when you want to use the fallback but you also want to know if conversion succeeded. See that snippet from Vladimir that I just quoted again in my reply to Matt.
I'm having a hard time envisioning why you would ever care if conversion
failed if you are specifying a default. Is that in the snippet you refer
to? Can you show it in this context to avoid confusion?
In any case you would then use the version returning optional and the
client code could then do what it needs to do.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk