Boost logo

Boost :

Subject: Re: [boost] Boost review of the Convert library is ongoing
From: feverzsj (feverzsj_at_[hidden])
Date: 2014-05-21 11:54:05


hi, list
  here are some personal opinions/thoughts on the convert lib:

1. in most cases, I found directly use of the converter would be more
convenient:

              int v = -1; // default value
              // no need to give the type of 'v'
              bool re = printf_converter()("123", v); // on failure, return
false, and 'v' is untouched

    so, I suggest add a default convert function using a default converter:

             template<class Src, class Dst>
             bool convert(Src const& src, Dst& dst)
             {
                    return default_converter()(src, dst);
             }

2. besides the generic ones, sprintf/sscanf converter still lacks some
format support from sprintf/sscanf:
    for example: auto-determined integer string, plus sign, padding, float
point format, etc.
    with most formats being supported, this converter would be the most
powerful, precise and efficient one;

3. printf_converter() uses snprintf(), while on msvc the return value
semantic is not standard conform;

4. printf_converter() uses fixed length char buf, while it is totaly
possible to remove this restrict with a standard conform snprintf();

regards.

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-review-of-the-Convert-library-is-ongoing-tp4662294p4662659.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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