On Jul 9, 2006, at 15:02, Robert Ramey wrote:
without seeing the code I'm not sure what to day.
Double check that namespace in which save_construct_data is declared/defined.
the save/load construct_data code is all in boost::serialization.
The declarations look like:
in node.h:
class Node {
// normal stuff
virtual ~Node();
virtual void some_function() = 0;
private:
template <class Archive> void serialize(Archive& ar, const
unsigned int version);
};
in simplenode.h:
class SimpleNode : public Node {
// normal stuff
private:
template <class Archive> void serialize(Archive& ar, const
unsigned int version);
};
in node.hh:
BOOST_CLASS_TRACKING(Node, boost::serialization::track_always)
BOOST_IS_ABSTRACT(Node)
in simplenode.hh:
BOOST_CLASS_TRACKING(CSimpleNode, boost::serialization::track_always)
namespace boost {
namespace serialization {
template <class Archive>
CORE_DATA_API void load_construct_data(Archive& ar,
SimpleNode * sn,
const unsigned
int version);
template <class Archive>
CORE_DATA_API void save_construct_data(Archive& ar,
const SimpleNode*
sn,
const unsigned
int version);
// I've also tried the save with all combinations of Node and
SimpleNode, * and &, and const/nonconst.
}
}
In another header (nodeset.h) I have:
#include "node.h"
class NodeSet {
typedef std::vector
I have a structure I'm trying to serialize that contains an STL vector of pointers to an abstract base type. When I serialize it, the save_construct_data free function is NOT called - the inline default version is always used. On de-serializing, the load_construct_data IS called! but, of course, fails because the data for it isn't there (although it throws archive_exception(archive_exception::unregistered_class) when it fails).