Boost logo

Boost :

Subject: Re: [boost] [convert] Boost.Convert Library Review
From: Matthew Chambers (matt.chambers42_at_[hidden])
Date: 2011-05-03 12:44:51

On 5/3/2011 3:54 AM, Thomas Heller wrote:
> On Tuesday, May 03, 2011 10:33:50 AM Vladimir Batov wrote:
>> If we decide to go ahead building/extending a set of converters (based on this
>> lib. or any other lib), then I'd probably favor the user choosing which
>> converter he/she wants by specifying
>> #include<boost/convert/string-to-bool-fast.hpp>
>> or
>> #include<boost/convert/string-to-int-spirit.hpp>
>> Something along these lines. That way stream-based converters would co-exist
>> with some quick ones. Just a thought.
> Wouldn't it be very tedious to incorporate the locales and formaters when using
> these optimizations? Have you really thought this through?
> Wouldn't it render all the "nice" operator overloading tricks useless?
> Again you claim your library to be extendable while it's not really. You have
> all those nice features so that you can easily use std locales and formatters
> (But i suspect these only work well with stdlib like streams).
> Once you incorporate any custom non stream based converter, all bets are off.
> Did I miss something obvious here?

I'd be happy with Vladimir's proposal of optional optimizations but there should also be a single
convenience header that represents the "best" conversion. Preferably one that provides optimal
performance for common string->numeric and numeric->string without invoking spirit's headers. See
Antony Polukhin's patches for lexical_cast:

Antony's patch can do locale-sensitive integral conversion (preprocessor disable-able) without
invoking streams at all, so it's certainly possible to extend and maintain the extra features. Of
course, it does add a lot of lines of code (essentially reimplementing and improving strtol), but
it's worth it IMO.


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