Subject: [Boost-bugs] [Boost C++ Libraries] #13299: small_vector<..>::emplace_back does not return the new element's reference
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-11-17 11:30:08
#13299: small_vector<..>::emplace_back does not return the new element's reference
----------------------------------------+---------------------------
Reporter: falko.loebner@⦠| Owner: Ion Gaztañaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
Version: Boost 1.63.0 | Severity: Problem
Keywords: small_vector, emplace_back |
----------------------------------------+---------------------------
I want to emplace a new item at the back of a small_vector and use the
reference to the new item:
{{{
boost::container::small_vector<int,16> myVec;
auto& newItem = myVec.emplace_back(10);
assert(newItem == 10); /* this fails */
}}}
It seems like the returned reference points to the last element of the
internal array (like myVec[15]). This element is uninitialized.
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13299> 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-11-17 11:36:24 UTC