Boost logo

Boost :

Subject: Re: [boost] Boost.Conversion - pre review request
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-07-09 11:27:00


On Jul 9, 2011, at 10:37 AM, "Hartmut Kaiser" <hartmut.kaiser_at_[hidden]> wrote:
>> I don't think that these kind of specific conversions could be added to
>> simple type-to-type conversions. As I signaled during the Boost.Convert
>> review I will use instead an auxiliary string stream and output and input
>> the types we want to convert using as many manipulators as the user wants.
>>
>> I have added an example here
>> http://svn.boost.org/svn/boost/sandbox/conversion/libs/conversion_ext/exam
>> ple/formatted.cpp
>> that shows how I will apply these kind of conversions. As you can see this
>> example doesn't make use of the Boost.Conversion generic functions when
>> manipulators are needed. Instead it uses either a template io stream
>> (extractor_stream) that is able to extract the type given as parameter
>> when the extract manipulator is used or a io stream ( via_stream) that is
>> able to extract any type given as parameter of the manipulator extract_to.
>
> This might be off topic and purely esthetical (i.e. personal taste), but I
> find the mix of operator>>() and operator<<() in the same expression to be
> more than confusing. That's (for me) clearly not a viable solution.

Although this is interesting work, I expect it may be wise not to try to cover lexical casts in this library, especially considering that lexical_cast and Coerce necessarily must have different interfaces.

What I was wondering was instead whether it'd be possible to pass extra arguments through convert_to.

I'd be satisfied with "no, if you need non-default formatting/parsing, use one of the string conversion libraries directly." I'd just like to firm up these sorts of scope issues well before the review so the ground isn't shifting under it.

Thanks, good discussion so far,
Gordon


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