Boost C++ Libraries: Ticket #9523: reserve() corrupts data in boost::bimap vector_of_relation https://svn.boost.org/trac10/ticket/9523 <p> bimap::reserve() has bad behavior: </p> <ol><li>Corrupts the data by inserting item into the empty bimap </li><li>Reserves incorrect amount of elements capacity </li></ol><p> Environment: Linux Ubuntu x64 3.2.0-57-generic 87-Ubuntu SMP, gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1 </p> <p> Code: </p> <pre class="wiki"> typedef unsigned Id; const unsigned m_nodes = 1518; typedef boost::bimap&lt;boost::bimaps::unordered_set_of&lt;Id&gt;, boost::bimaps::unconstrained_set_of&lt;Id&gt;, boost::bimaps::vector_of_relation&gt; Nbimap; Nbimap m_nbimap; fprintf(stderr, "Initial bmsize: %u, capacity: %u\n", m_nbimap.size(), m_nbimap.capacity()); m_nbimap.reserve(m_nodes); fprintf(stderr, "Postreserve bmsize: %u, capacity: %u, nsize: %u\n", m_nbimap.size(), m_nbimap.capacity(), m_nodes); </pre><p> Console output: </p> <pre class="wiki">Initial bmsize: 0, capacity: 0 Postreserve bmsize: 1, capacity: 15, nsize: 1518 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9523 Trac 1.4.3