Boost logo

Boost :

Subject: Re: [boost] Boost.Conversion - pre review request
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-07-09 11:08:59


Gordon Woodhull wrote:
>
> On Jul 9, 2011, at 10:41 AM, "Hartmut Kaiser"
> <hartmut.kaiser_at_[hidden]> wrote:
>
>>> I don't see why we need to specify that the format is hexadecimal. I
>>> would
>>> expect that the spirit grammar associated to the coerce library will
>>> take
>>> care of all the formats without any specific additional tag.
>>
>> Doing implicit conversion from 0x17 to 'int' without explicit guidance
>> from the user (i.e. by telling to convert from hex) is not a good idea,
>> IMHO. I'd suggest to make the conversion explicit as much as possible,
>> which usually amounts to the least surprised user.
>
> E.g. 700 is different values in octal, decimal, hexadecimal.
>
>

On the current implementation if you try to convert "700" to an int you will
get 700. If you want to take it as the representation of other than a
decimal number you will need to use explicitly a specific library that
provide it, as Boost.Coerce could do.

If the Boost community consider that there is no good default behavior fro
string to int conversion I will remove this specializations.

Anyway, what is the result of

  coerce::as(*int*)("700");

?
Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-Conversion-pre-review-request-tp3650286p3656281.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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