Boost logo

Boost :

Subject: Re: [boost] [review] string convert
From: Vladimir Batov (vbatov_at_[hidden])
Date: 2011-05-03 07:10:43


> Vicente BOTET <vicente.botet <at> wanadoo.fr> writes:
>> De : "Stewart, Robert"
>> I understand that there are things hiding behind a façade:
>>
>> - convert::from(d) returns a convert::result
>> - convert::from(d) acts like a std::istream WRT manipulators
>> - convert::from() returns a convert::converter
>>
>> I also get that convert::result converts implicitly to a string but can also
> be queried via a safe-bool and
> directly for the string, but adding lots of explicit wrappers into the mix just
> obfuscates the desired
> conversion operation. It makes things more obvious, but syntactically obese.
>
> You are right trying to force all around a single function gives non natural
> results. This is the main issue
> with this library. I'm sure we can find some more explicit, readable and
> acceptable syntax.

Correction. If you have a look at the convert::from() signature(s), you'll see
that all overloads of the function *always* return the same -- namely the
configured converter. Simple, uniform, unambiguous, non-confusing.

Now it's up to the respective converter to implement (or not) certain
functionality. Say, a fast converter will sacrifice locales/formatting for
speed, etc. I'd personally like to see different converters available which the
user would choose from via

#include <convert/string-to-int-spitit.hpp>

or something of that sort.

V.


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