Boost Users :
Subject: [Boost-users] [Serialization] Load an object from the base pointer
From: Ryan Fowler (Ryan.Fowler_at_[hidden])
Date: 2009-03-04 10:30:07
How can I read in a from a stream when I don't know the exact type I
will be getting? All objects I receive will derive from the same base
class, but I won't know when I receive the stream what the derived type
will be and therefore I can't create it in advance (like in the docs).
class derived1 : public base
class derived2 : public base
// Get a stream from somewhere
boost::archive::binary_iarchive ia( instream );
is >> // derived1 or derived2???
This email was sent to you by Thomson Reuters, the global news and information company.
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
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