|
Boost : |
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2007-09-04 03:11:02
Hello,
Lubomir Bourdev <lbourdev_at_[hidden]> wrote:
> The bug is not in the implementation but in the name of the function.
> It really should be called "convert_from_unsigned" instead of
> "convert_to_signed" because it takes the _destination_ type as its
> parameter.
> [...]
>
> In your case you should write your own metafunctions.
> Metafunctions like is_integral_scalar, is_signed, add_sign and
> remove_sign should be added to Boost.TypeTraits in my opinion.
Agreed. I also noticed that, just getting the signed type is not
enough. E.g. when converting with a conversion function that does
not yield the nearest color, I might get an error bigger than the signed
type can hold.
Thank you for clearing that up.
Regards
Andreas Pokorny
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk