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

              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();


View this message in context:
Sent from the Boost - Dev mailing list archive at

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