|
Boost Users : |
From: Daniel Krügler (dsp_at_[hidden])
Date: 2005-11-11 08:47:38
Hello!
The example for boost::numeric_cast contains
documentation, which clearly is wrong and stumbles the reader.
On
http://boost.org/libs/numeric/conversion/doc/numeric_cast.html#numeric_cast
we have the lines
unsigned long l=std::numeric_limits<unsigned long>::max();
// This works, because unsigned integral types cannot cause overflow.
unsigned char c=numeric_cast<unsigned char>(l);
which contradict the behaviour and the range checking logic presented on
http://boost.org/libs/numeric/conversion/doc/converter.html#rchklogic
Btw.: Further on the #include directive, namely
#include <boost/numeric_cast.hpp>
should be corrected to
#include <boost/numeric/conversion/cast.hpp>
Greetings from Bremen,
Daniel Krügler
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net