Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-02-21 02:24:57

>> convert<string, int>(str, -1) >> throw_t();
>> // What does -1 mean here?
> That "-1" indeed looks kind of out of place, doesn't it? :-)

Unfortunately, there are classes that do not have default constructors (I
have a few). For them we need

direction dir = convert<srting, direction>(str, direction_up);

Those classes *might* like to have throwing behavior. Therefore, for those
we need

direction dir = convert<srting, direction>(str, direction_up) >> throw_t();

> int i = convert_to<int>(str) // throws on failure
> int i = convert_from<string, int>(str, -1) // returns -1 on failure
> int i = convert_from(str, -1) // the same as above

Done as above.

> and throw_t scrapped. Any objections?

I seem to have to bring it back for the case I described above.


Boost list run by bdawes at, gregod at, cpdaniel at, john at