|
Boost Users : |
Subject: Re: [Boost-users] serialization of standard unordered containers
From: Brian Budge (brian.budge_at_[hidden])
Date: 2013-07-28 17:21:22
On Sun, Jul 28, 2013 at 11:56 AM, niXman <i.nixman_at_[hidden]> wrote:
> 2013/7/28 niXman:
>> 2013/7/28 Brian Budge:
>>
>>> Can this library do serialization through a base pointer?
>> Yes.
> Although I'm not sure I understand you correctly...
>
struct A {};
struct B : public A {};
struct C : public A {};
...
A *b = new B();
A *c = new C();
archive.serialize(b);
archive.serialize(c);
...
A *db, *dc;
archive.deserialize(db);
archive.deserialize(dc);
// now db should be a pointer to identical contents to b, and concrete
type B, and dc should be a pointer to identical contents to c and
concrete type C
Brian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net