Opened 6 months ago

Closed 3 weeks ago

#13299 closed Bugs (fixed)

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:


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 (1)

comment:1 Changed 3 weeks ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Seems to be the same problem as explained in:

which was fixed for Boost 1.64. Many thanks for the report.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.