Subject: [Boost-bugs] [Boost C++ Libraries] #9523: reserve() corrupts data in boost::bimap vector_of_relation
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-12-24 18:15:22
#9523: reserve() corrupts data in boost::bimap vector_of_relation
------------------------------------------------+---------------------
Reporter: Artem V L <luart@â¦> | Owner: matias
Type: Bugs | Status: new
Milestone: Boost 1.56.0 | Component: bimap
Version: Boost 1.54.0 | Severity: Problem
Keywords: bimap, reserve, vector_of_relation |
------------------------------------------------+---------------------
bimap::reserve() has bad behavior:
1. Corrupts the data by inserting item into the empty bimap
2. Reserves incorrect amount of elements capacity
Environment: Linux Ubuntu x64 3.2.0-57-generic 87-Ubuntu SMP, gcc (Ubuntu
4.8.1-2ubuntu1~12.04) 4.8.1
Code:
{{{
typedef unsigned Id;
const unsigned m_nodes = 1518;
typedef boost::bimap<boost::bimaps::unordered_set_of<Id>,
boost::bimaps::unconstrained_set_of<Id>,
boost::bimaps::vector_of_relation> 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);
}}}
Console output:
{{{
Initial bmsize: 0, capacity: 0
Postreserve bmsize: 1, capacity: 15, nsize: 1518
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9523> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC