</code></pre></div><p>The type used to store JSON numbers (unsigned).</p><p><ahref=https://tools.ietf.org/html/rfc8259>RFC 8259</a> describes numbers as follows:</p><blockquote><p>The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.</p></blockquote><p>This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, <ahref=../number_integer_t/><code>number_integer_t</code></a>, <code>number_unsigned_t</code> and <ahref=../number_float_t/><code>number_float_t</code></a> are used.</p><p>To store unsigned integer numbers in C++, a type is defined by the template parameter <code>NumberUnsignedType</code> which chooses the type to use.</p><h2id=notes>Notes<aclass=headerlinkhref=#notestitle="Permanent link">¶</a></h2><h4id=default-type>Default type<aclass=headerlinkhref=#default-typetitle="Permanent link">¶</a></h4><p>With the default values for <code>NumberUnsignedType</code> (<code>std::uint64_t</code>), the default value for <code>number_unsigned_t</code> is <codeclass=highlight><spanclass=n>std</span><spanclass=o>::</span><spanclass=kt>uint64_t</span><spanclass=w></span></code>.</p><h4id=default-behavior>Default behavior<aclass=headerlinkhref=#default-behaviortitle="Permanent link">¶</a></h4><ul><li>The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal <code>010</code> will be serialized to <code>8</code>. During deserialization, leading zeros yield an error.</li><li>Not-a-number (NaN) values will be serialized to <code>null</code>.</li></ul><h4id=limits>Limits<aclass=headerlinkhref=#limitstitle="Permanent link">¶</a></h4><p><ahref=https://tools.ietf.org/html/rfc8259>RFC 8259</a> specifies:</p><blockquote><p>An implementation may set limits on the range and precision of numbers.</p></blockquote><p>When the default type is used, the maximal integer number that can be stored is <code>18446744073709551615</code> (UINT64_MAX) and the minimal integer number that can be stored is <code>0</code>. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as <ahref=../number_integer_t/><code>number_integer_t</code></a> or <ahref=../number_float_t/><code>number_float_t</code></a>.</p><p><ahref=https://tools.ietf.org/html/rfc8259>RFC 8259</a> further states:</p><blockquote><p>Note that when such software is used, numbers that are integers and are in the range \f<spanclass=arithmatex><spanclass=MathJax_Preview>[-2^{53}+1, 2^{53}-1]\f</span><scripttype=math/tex>[-2^{53}+1,2^{53}-1]\f</script></span> are interoperable in the sense that implementations will agree exactly on their numeric values.</p></blockquote><p>As this range is a subrange (when considered in conjunction with the <code>number_integer_t</code> type) of the exactly supported range [0, UINT64_MAX], this class's integer type is interoperable.</p><h4id=storage>Storage<aclass=headerlinkhref=#storagetitle="Permanent link">¶</a></h4><p>Integer number values are stored directly inside a <code>basic_json</code> type.</p><h2id=examples>Examples<aclass=headerlinkhref=#examplestitle="Permanent link">¶</a></h2><detailsclass=example><summary>Example</summary><p>The following code shows that <code>number_unsigned_t</code