Boost logo

Boost :

Subject: Re: [boost] [conversion] try_lexical_cast and 200$
From: Peter Dimov (lists_at_[hidden])
Date: 2013-12-12 09:24:40


Krzysztof Czainski wrote:
> Whether this or try_lexical_cast, I prefer the function to return an
> optional.

As I said, it's appealing, but I suspect that it will prove much less
convenient in practice.

struct X
{
    int a;
    int b;
};

bool parse( X& x, std::string a, std::string b )
{
    return try_lexical_cast( a, x.a ) && try_lexical_cast( b, x.b );
}


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