Boost C++ Libraries: Ticket #11957: static_vector::max_size() is higher than the capacity https://svn.boost.org/trac10/ticket/11957 <p> According to the documenetation, both static_vector capacity() and max_size() shall return the static_vector capacity: </p> <pre class="wiki">static_vector public static functions static size_type capacity() noexcept; Returns container's capacity. Throws. Nothing. Complexity. Constant O(1). static size_type max_size() noexcept; Returns container's capacity. Throws. Nothing. Complexity. Constant O(1). </pre><p> This makes sense since the capacity is fixed at compile time. </p> <p> However it is not actually the case </p> <pre class="wiki">$ cat svect.cpp #include &lt;cstdlib&gt; #include &lt;boost/container/static_vector.hpp&gt; #include &lt;iostream&gt; int main() { boost::container::static_vector&lt;char, 42&gt; sv; std::cout &lt;&lt; "sv.size(): " &lt;&lt; sv.size() &lt;&lt; "\nsv.capacity(): " &lt;&lt; sv.capacity() &lt;&lt; "\nsv.max_size(): " &lt;&lt; sv.max_size() &lt;&lt; "\n"; return (sv.max_size() == sv.capacity()) ? EXIT_SUCCESS : EXIT_FAILURE; } </pre><pre class="wiki">$ clang++ --std=c++11 svect.cpp &amp;&amp; ./a.out sv.size(): 0 sv.capacity(): 42 sv.max_size(): 18446744073709551615 </pre><pre class="wiki">$ echo $? 1 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11957 Trac 1.4.3 barthelemy@… Fri, 05 Feb 2016 11:11:28 GMT <link>https://svn.boost.org/trac10/ticket/11957#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11957#comment:1</guid> <description> <p> subscribe </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Wed, 24 Feb 2016 13:49:31 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11957#comment:2 https://svn.boost.org/trac10/ticket/11957#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks for the report. Fixed in: </p> <p> <a class="ext-link" href="https://github.com/boostorg/container/commit/310d8eaf10be14b6a9457fd1284bab761d50c8e2"><span class="icon">​</span>https://github.com/boostorg/container/commit/310d8eaf10be14b6a9457fd1284bab761d50c8e2</a> </p> Ticket jim.king@… Thu, 16 Jun 2016 14:53:25 GMT <link>https://svn.boost.org/trac10/ticket/11957#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11957#comment:3</guid> <description> <p> Should the Milestone be set to 1.61 since this appears to have been fixed in 1.61.0 ? </p> </description> <category>Ticket</category> </item> </channel> </rss>