[serialization] pointer derived from an abstract templated class
Hello, I know the question has already been asked (http://groups.google.com/group/boost-list/browse_thread/thread/9e1bcbd7c4f76cb8/7cfd47f06f01bf71?lnk=st&q=serialize+template+abstract+boost&rnum=1&hl=en#7cfd47f06f01bf71) but without answers. So I retry.. Is it possible to serialize an object that inherits from a templated abstract class ? For instance : template<typename T> class base { }; template<typename T> class Impl : public base<T> { }; int main(/* ... */) { base *b = new Impl(type); // how can we serialize b ? } Thanks for your help.
On Mon, 28 Nov 2005 09:47:08 -0200,
Hello,
I know the question has already been asked (http://groups.google.com/group/boost-list/browse_thread/thread/9e1bcbd7c4f76cb8/7cfd47f06f01bf71?lnk=st&q=serialize+template+abstract+boost&rnum=1&hl=en#7cfd47f06f01bf71) but without answers. So I retry..
Is it possible to serialize an object that inherits from a templated abstract class ?
For instance :
template<typename T> class base { };
template<typename T> class Impl : public base<T> { };
You can hack your way to it by means similar to the ones I used here http://groups.google.com/group/boost-list/browse_thread/thread/2c91d43bb78ea... However, your case is slightly different. In your case it shouldn't matter if Impl<A> and Impl<B> are given the same name, because there's not chance of mixing the two due to C++ typing rules. I don't know if this works in the serialization library as it is, though. Bruno
participants (2)
-
Bruno Martínez
-
codeur@altern.org