Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-02-21 02:18:51

> 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)?

I am very open to whatever comes out of it. I am not married to those
manipulators but you'll have to tell me more about using Boost.Parameter. To
solve that particular problem that you describe the user would write his own
manipulator and nothing needs to be done in boost::convert. That user manip.
would do boundary checks and stuff. Then,

short i = convert_to<short>("0xFFFFFFFF") >> my_short_manip;

I personally do not like manipulators. I do not even really know how to
write them properly. However, they are standard. So, we can say to
someone -- you wanna do your own formatting? Bring in your manipulator and
plug it in. Boost.Convert does not need to be changed to accommodate that
specific request.

How do you do that with Boost.Parameter? How Boost.Convert will know about
"throw_on_out_of_range_" or any fancy parameter? How Boost.Convert will
apply/interpret that parameter? If you tell me that the user can make
Boost.Convert understand that new parameter without modifying Boost.Convert,
I'll be first to abandon manipulators in their favor.


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