The Not-a-Number Value

Sometimes it's useful for a variable to have a value that doesn't represent any proper value, to indicate that it hasn't been specified or that there was an error in a calculation. For that purpose, the Nothrow variants of the integer_t type provide a Not-a-Number value.

(Note that this value can only be held by the Nothrow variants of integer_t. If you try to assign it to another variant, you'll get a not_a_number exception.)

To create a Not-a-Number, use the integer_t::nan function. No other library function will return a Not-a-Number except under the following circumstances:

The only things you can do with a Not-a-Number are:

If you attempt to do anything else with it, you will get a special value indicating failure (which will be another Not-a-Number, if the function you're calling returns an integer_t).


© 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)