nothrow_integer
type? Several people on the Boost developers' mailing list expressed reservations about the exception-blocking mechanism in the original implementation, and the Not-a-Number value that it required. After a spirited debate, two indisputable points emerged:
To deal with this, I separated the xint::integer
and xint::nothrow_integer
types. xint::integer
functions now always throw exceptions on errors, and always hold valid numbers; xint::nothrow_integer
functions (as implied by the name) never throw exceptions, instead returning the Not-a-Number value (which only nothrow_integer
can hold).
This design ensures that the Not-a-Number value only needs to be checked for in the nothrow_integer
code, and ensures that any speed penalty from it is only incurred by people who choose to use the nothrow_integer
type. It also preserves the no-exceptions behavior, which is useful under some circumstances.
© Copyright Chad Nelson, 2010-2011. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)