Boost logo

Boost :

Subject: [boost] [convert] Version in the Vault ready for review.
From: Vladimir.Batov_at_[hidden]
Date: 2009-03-01 19:02:24

After listening to many views, opinions, suggestions I've re-done
boost::convert and would like it scheduled for a review.

It is certainly nowhere as MPL and still not perfect. However, I believe
it will be very useful to many developers (like me) not satisfied with
lexical_cast and not (yet?) needing (or ready for) something like upcoming
Spirit 2.0.

Overall, after weighing all pros and cons, I am reasonably happy with the
current interface and implementation. It does not implement all that have
been discussed and suggested. It is most unlikely implemented the way some
would like it to see. However, I had to make choices I felt comfortable
with and I feel the current interface is minimal, readable and allows for
further growth.

With that review-request I would like to avoid opening up another round of
discussions if 'from' was a good, bad, mediocre choice. I feel we've
exhausted that topic and I would like people to simply vote if they find
the functionality needed. I am most certainly prepared to eat my humble
pie if the vote is 'no'. Still, I am very much looking forward to any
implementation-related suggestions/corrections or new ideas we have not
discussed so far.

The current interface can be summed up as with as little as

    int i = convert<int>::from(str); // Throws on failure
    int i = convert<int>::from(str, -1); // Returns -1 on failure

More details can be found in the accompanying document (just remember I am
not Shakespeare).

If/when we decide to extend that by incorporating, say, Boost.Parameter
and/or Spirit, then it might be as

    int i = convert<int>::from(str)(radix_ = 10, more_parm_ = ...);
    int i = convert<int>::from(str)(some Spirit related stuff);

I am prepared to look into it further... if this initial proposal is
accepted... otherwise, it'll be less work for me. :-)

Thank you everyone who participated in the lexical_cast/convert
discussions. Your views, opinions, suggestions were very helpful and
educating and are very much appreciated. I hope I did not forget anyone in
the "acknowledgements" list.

The file called can be found in the Vault at


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