> From: Samuel Krempp [mailto:krempp@crans.ens-cachan.fr]
[snip]
> But by the way, does boost provide functions for integral types
> conversion that checks against over-limit numbers ?
> or is there a std:: way to do it, that I don't know ?
> for instance, I'm always uncomfortable casting an unsigned to signed.
> Taking the habit of static_cast'ing types without checking
> for possible
> over-limit problems can cause unnecessary risks of obscure failures,
> sooner or later, when we do reach the limit..

Boost.Conversion contains a very handy tool for this - numeric_cast. It is slightly broken as of now, but it still makes sense to use it. An improved version is on the rise, with correct behavior, an optimized implementation and added features (thanks to Fernando Cacciola).

Bjorn