
Hi, I still got some starting problems with the boost::serialization library. I want to serialize a shared_ptr to my own polymorphic class. I'm building my own networkprotocol and the basic idea is a kind of "header"-class which with a shared_ptr<data_base> which can point to a lot of different data structs, which are polymorphic children of data_base. This "header"-class is then serialized and send to another peer. But how should this peer get the real type from the shared_ptr<data_base>? Which child is it pointing to? I can get the name with "typeid()", but i cannot get the type through that way. I would like to get the type from it automaticly without using some case-conditions, so i only have to add a new child of data_base and can use it, without changing any networkprotocol related code. Kind Regards Manuel Jung

This is all handled automatically by the library. Read the information related to serialization of pointers. Robert Ramey Manuel Jung wrote:
Hi,
I still got some starting problems with the boost::serialization library. I want to serialize a shared_ptr to my own polymorphic class. I'm building my own networkprotocol and the basic idea is a kind of "header"-class which with a shared_ptr<data_base> which can point to a lot of different data structs, which are polymorphic children of data_base.
This "header"-class is then serialized and send to another peer. But how should this peer get the real type from the shared_ptr<data_base>? Which child is it pointing to? I can get the name with "typeid()", but i cannot get the type through that way. I would like to get the type from it automaticly without using some case-conditions, so i only have to add a new child of data_base and can use it, without changing any networkprotocol related code.
Kind Regards Manuel Jung

Robert Ramey wrote:
This is all handled automatically by the library. Read the information related to serialization of pointers.
Hi, I allready read it. And i think i finally found the mistake in my head... for some reason i wanted to get a type out of a polymorphic derived class... but getting a type at runtime... isnt possible! Oh my.. Thanks! Manuel Jung
participants (2)
-
Manuel Jung
-
Robert Ramey