[serialization] [archive] Bug serializing vectors consecutively

Hi, I've hit what I believe is a bug in boost serialization, at least on binary and text archive modes. If I have two member vectors (of int, for example), and the serialize code is like this: ar & vector1; ar & vector2; I cannot deserialize it back, since boost throws "stream error" if it's a text archive, or "std::length_error" on vector::reserve if it's a binary archive. Attached is an example code. att, -- Paul Eipper

Paul Eipper wrote:
Hi,
I've hit what I believe is a bug in boost serialization, at least on binary and text archive modes.
void save() { ... oa << this; }; void load() { std::ifstream ifs(filename.c_str()); // needs binary mode ... ia >> *this; // your not loading what you serialized? }; Jeff

On Tue, Aug 25, 2009 at 3:57 PM, Jeff
Flinn
Paul Eipper wrote:
Hi,
I've hit what I believe is a bug in boost serialization, at least on binary and text archive modes.
void save() { ...
oa << this; };
void load() { std::ifstream ifs(filename.c_str()); // needs binary mode ... ia >> *this; // your not loading what you serialized? };
Jeff
You guys are correct, I thought it was a bug because when using the xml archive it was working like this thanks :) -- Paul Eipper

change oa << this; to oa << *this Paul Eipper wrote:
Hi,
I've hit what I believe is a bug in boost serialization, at least on binary and text archive modes.
If I have two member vectors (of int, for example), and the serialize code is like this:
ar & vector1; ar & vector2;
I cannot deserialize it back, since boost throws "stream error" if it's a text archive, or "std::length_error" on vector::reserve if it's a binary archive. Attached is an example code.
att, -- Paul Eipper
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Am Tuesday 25 August 2009 20:08:14 schrieb Paul Eipper:
I cannot deserialize it back, since boost throws "stream error" if it's a text archive, or "std::length_error" on vector::reserve if it's a binary archive. Attached is an example code.
not a bug, you are serializing a pointer, but deserializing an object. this vs. *this.
participants (4)
-
Jeff Flinn
-
Paul Eipper
-
Robert Ramey
-
Stefan Strasser