|
Boost : |
Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-21 01:22:51
Vladimir Batov wrote:
>> Then having support of Boost.Parameter, we could pass some
>> customization to the converter constructor:
>>
>> std::transform(
>> integers.begin(),
>> integers.end(),
>> std::back_inserter(strings),
>> converter<int, string>(radix_ = 16, uppercase_ = true));
>
> I looked a Boost.Parameter and will certainly try using it somewhere. My
> hesitation with it for boost::convert is I am under impression that the
> set of acceptable parameters (radix_, etc.) has to be predefined and
> therefore cannot be extended by the user when formatting like
> "convert(str) >> std::hex" seems more flexible.
You can add new keywords as needed. The point is that the underlying
conversion mechanism can support a subset of these keywords, specific to
the conversion domain. This way it will be a non-intrusive extension.
On the other hand, using manipulators, like std::hex, is clearly more
limiting, as they may be meaningless for the particular conversion
requested. For example, how would it be extended to support convert<
short >(0xFFFFFFFF, throw_on_out_of_range_ = true)?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk