[Boost-bugs] [Boost C++ Libraries] #11498: Deserialization of a vector does not delete existing elements

Subject: [Boost-bugs] [Boost C++ Libraries] #11498: Deserialization of a vector does not delete existing elements
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-07-24 20:27:51


#11498: Deserialization of a vector does not delete existing elements
------------------------------+---------------------------
 Reporter: pcarnevali@… | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.58.0 | Severity: Showstopper
 Keywords: |
------------------------------+---------------------------
 Problem deserializing (loading) an std::vector in boost 1.58.0. If the
 vector is not empty, the existing elements are not removed. The code
 compiles and serialization completes without errors, but after
 deserialization the vector has the deserialized vector elements appended
 after the previously existing elements. This is not the correct and
 documented behavior. Works fine in boost 1.56.0. See the attached program,
 which does the following:

 - Creates an object of class B, called b1, containing a vector of 3
 objects of class A. Class A does have a public default constructor.
 - The b1 object is serialized (stored) using the boost serialization
 library.
 - A new object of class B, called b2, is created, and initialized with two
 elements.
 - Finally, the b2 object is loaded, using serialization, from the archive
 on which b1 was saved.
 - The program compiles and terminates without errors, but at the end the
 b2 object contains the initial 2 elements plus the 3 elements loaded from
 b1, for a total 5 elements.

 This is with gcc 4.8.2 on Linux Centos-7.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11498>
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:18 UTC