Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Polymorphism?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-11-04 20:39:35

  "Robert Dailey" <rcdailey_at_[hidden]> wrote in message

  I have a class named Bar which derives from a class named Foo. Both Foo and Bar are serializable, and thus they both have the respective serialize() functions. However, if I do the following, you will not get a polymorphic call since you cannot have virtual template members in a class (The serialize() function must be a template according to the Boost.Serialization docs).

  Foo* f = new Bar;

  Note that you wouldn't call serialize() directly like this, I'm simply doing it to prove a point. At some point Boost.Serialization is going to want to call the Serialize() function off of my Foo object, however it will not call Bar::serialize() as I would expect since I cannot make serialize() virtual. How would I provide polymorphic serialization of objects in Boost.Serialization?

Doesn't adequately explain?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at