Modify

Opened 4 weeks ago

#13299 new Bugs

small_vector<..>::emplace_back does not return the new element's reference

Reported by: falko.loebner@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.63.0 Severity: Problem
Keywords: small_vector, emplace_back Cc:

Description

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.

Attachments (0)

Change History (0)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Ion Gaztañaga.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.