template<template< typename U, typename V, typename...Args > class ObjectType = std::map, template< typename U, typename...Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = int64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator></div>
<p>Returns the maximum number of elements a JSON value is able to hold due to system or library implementation limitations, i.e. <code>std::distance(<aclass="el"href="classnlohmann_1_1basic__json_af4261341695729a8e657b94772f95516.html#af4261341695729a8e657b94772f95516"title="returns an iterator to the first element ">begin()</a>, <aclass="el"href="classnlohmann_1_1basic__json_ad8f84e6fb9bbf9a7bc767962ad0fe3a1.html#ad8f84e6fb9bbf9a7bc767962ad0fe3a1"title="returns an iterator to one past the last element ">end()</a>)</code> for the JSON value.</p>
<dlclass="section return"><dt>Returns</dt><dd>The return value depends on the different value types and is defined as follows: <tableclass="doxtable">
<tr>
<th>Value type </th><th>return value </th></tr>
<tr>
<td>null </td><td><code>0</code></td></tr>
<tr>
<td>boolean </td><td><code>1</code></td></tr>
<tr>
<td>string </td><td><code>1</code></td></tr>
<tr>
<td>number </td><td><code>1</code></td></tr>
<tr>
<td>object </td><td>result of function object_t::max_size() </td></tr>
<tr>
<td>array </td><td>result of function array_t::max_size() </td></tr>
</table>
</dd></dl>
<dlclass="section user"><dt>Complexity</dt><dd>Constant, as long as <aclass="el"href="classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html#ac82abedf356d252e0589850c3d8b35ba">array_t</a> and <aclass="el"href="classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html#a63691315292df8e1522b00d37ebb1ffc">object_t</a> satisfy the Container concept; that is, their <aclass="el"href="classnlohmann_1_1basic__json_a0998ed4a76d1e5048fd043475eb7bfde.html#a0998ed4a76d1e5048fd043475eb7bfde"title="returns the maximum possible number of elements ">max_size()</a> functions have constant complexity.</dd></dl>
<dlclass="section user"><dt>Requirements</dt><dd>This function satisfies the Container requirements:<ul>
<li>The complexity is constant.</li>
<li>Has the semantics of returning <code>b.size()</code> where <code>b</code> is the largest possible JSON value.</li>
</ul>
</dd></dl>
<dlclass="section user"><dt>Example</dt><dd>The following code calls <aclass="el"href="classnlohmann_1_1basic__json_a0998ed4a76d1e5048fd043475eb7bfde.html#a0998ed4a76d1e5048fd043475eb7bfde">max_size</a> on the different value types. Note the output is implementation specific. <divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="preprocessor">#include <json.hpp></span></div>
<divclass="ttc"id="classnlohmann_1_1basic__json_html"><divclass="ttname"><ahref="classnlohmann_1_1basic__json.html">nlohmann::basic_json</a></div><divclass="ttdoc">a class to store JSON values </div><divclass="ttdef"><b>Definition:</b> json.hpp:121</div></div>
<divclass="ttc"id="namespacenlohmann_html"><divclass="ttname"><ahref="namespacenlohmann.html">nlohmann</a></div><divclass="ttdoc">namespace for Niels Lohmann </div><divclass="ttdef"><b>Definition:</b> json.hpp:56</div></div>
<divclass="ttc"id="classnlohmann_1_1basic__json_a0998ed4a76d1e5048fd043475eb7bfde_html_a0998ed4a76d1e5048fd043475eb7bfde"><divclass="ttname"><ahref="classnlohmann_1_1basic__json_a0998ed4a76d1e5048fd043475eb7bfde.html#a0998ed4a76d1e5048fd043475eb7bfde">nlohmann::basic_json::max_size</a></div><divclass="ttdeci">size_type max_size() const noexcept</div><divclass="ttdoc">returns the maximum possible number of elements </div><divclass="ttdef"><b>Definition:</b> json.hpp:2560</div></div>