Opened 8 years ago

Closed 7 years ago

#11214 closed Bugs (fixed)

Wrong number of entries in std::vector<boost::tuple<double, double, double> >

Reported by: Ruediger Berlich <r.berlich@…> Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.58.0 Severity: Regression
Keywords: serialization tuple vector Cc:

Description

I have a class with a std::vector<boost::tuple<double, double, double> >, that is supposed to always have at least one entry, but may have more. Hence, in the default constructor, I initialize the std::vector with one entry. The class is also serializable. Up until Boost 1.57, a de-serialized object always had the correct number of entries in the vector. As of 1.58, I am getting one entry too much, which probably means that Boost.Serialization simply attaches entries to the vector of a default-constructed class, but doesn’t clear it first. This happens in C++11-Mode, both on Ubuntu 14.10 (gcc 4.9.1) as well as on MacOS X Yosemite . It DOES NOT happen with a std::vector<double> . Attached to this ticket is a full test case that replicates the problem in a simplified environment.

For Boost 1.57 the program returns:

t_vec.size() = 1
t_vec2.size() = 1

For Boost 1.58 the answer is

t_vec.size() = 1
t_vec2.size() = 2

Best Regards,
Beet

Attachments (1)

vecwrongsize.cpp (1.5 KB ) - added by Ruediger Berlich <r.berlich@…> 8 years ago.
Test case for ticket 11214

Download all attachments as: .zip

Change History (2)

by Ruediger Berlich <r.berlich@…>, 8 years ago

Attachment: vecwrongsize.cpp added

Test case for ticket 11214

comment:1 by Robert Ramey, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.