Boost logo

Boost :

Subject: Re: [boost] numeric_cast
From: Brandon Kohn (blkohn_at_[hidden])
Date: 2011-07-14 12:05:12


On 7/11/2011 12:25 PM, Antony Polukhin wrote:
> 2011/7/11 Paul A. Bristow<pbristow_at_[hidden]>:
>> If so should it go into our Boost style 'recommendations' docs
somewhere?
>
> If you keep the behaviour stable for the fundamental types, then I
> have no objections. It will be a good feature! But the final decision
> must take the maintainer.
>
> Best regards,
> Antony Polukhin

That's great. :)

I've put together a more streamlined patch that includes a preprocessed
set of traits for the fundamental types. I chose to explicitly generate
them from macros rather than use enable_if tricks to avoid compile time
costs. One problem I foresee is how to arrive at a unique set of
fundamental types for each compiler. I used boost/cstdint.hpp and the
definitions there for the integral type (u/int8_t etc.) I found
something that was a bit of a surprise though on msvc10. The 'char' type
is not the same as int8_t (signed char) or uint8_t(unsigned char). I
would have expected the former. I explicitly added char specialization
to the args sent to the code generation macros, but I expect this won't
be correct for all compilers.

Cheers,

Brandon




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