Boost logo

Boost :

Subject: Re: [boost] [review] string convert
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2011-05-04 15:03:09


On Wed, May 4, 2011 at 11:37, Matthew Chambers
<matt.chambers42_at_[hidden]> wrote:
>
> Did we just rediscover Vladimir's reasoning for the ::from interface?
>

Sounds like :)

>
> If so, I think the cure is worse than the disease.
>

I really like the split into two parts, to allow a direction word.

If you don't like the ::from, what about something like this?
    foo(convert(x).to<int>());
    optional<int> i = convert(x).to<int>(std::nothrow); // or maybe
.try_to<int>()

It's arguably the same as the .value() in Vladimir's lib, except that
by delaying providing the type, it makes sense that it's needed.

The scary implicit conversions might even make some sense when there's
no destination type:
    int i = convert(x);

~ Scott


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