Boost logo

Boost :

Subject: Re: [boost] numeric_cast
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-06-22 13:15:12

Antony Polukhin wrote:
> 2011/6/22 Brandon Kohn <blkohn_at_[hidden]>:
>> The defaults of numeric_cast_traits definition conform to the current
>> behavior. It would only change if the users customize it. From that angle
>> I
>> think the greater flexibility comes with a bit more responsibility on the
>> users side. Seems like a fair trade-off to me.
> Well, then here is some ideas.
> I am really afraid that some user will define such trait in header
> file. Then all the code above the included header file will use the
> old conversion trait, and below - the new trait. Include files became
> dependent from their order. It is really error prone. User can forget
> about the trait, change the inclusion order and get some really hard
> detectable errors. So it would be more save not to modify the behavior
> of boost::numeric_cast<N>(x) function, but rather create function with
> some other name, for example boost::numeric_traited_cast<N>(x) and
> create a separate namespace in boost::numeric for the traits.

You are right that changing the implementation in this way can break some
code in the future.
Maybe we should be more conservative.

The library has already a namespace boost::numeric so what about
boost::numeric::convert_to/convert instead?


View this message in context:
Sent from the Boost - Dev mailing list archive at

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