|
Boost Users : |
From: Hughes, James (jhughes_at_[hidden])
Date: 2007-05-02 04:14:50
Hi All,
I am trying to serialise a vector of shared_ptr's which point to a base
class which may be one of a number of derived class (Not polymorphic in
that the base class has no virtual functions - its just supplies base
functionality to derived classes)
In very pseudo code
Class A
Class B : public A
Class C : public A
vector<shared_ptr<A> > list;
list.insert(shared_ptr<A> (new B));
list.insert(shared_ptr<A> (new C));
In serialise
Ar & boost::serialization::make_nvp("ListofStuff", list);
Reading the documentation, I believe this should work, but I am getting
a bus error on our embedded system when it tries to serialise the vector
(all the other bits have serialised ok which implies it's all compiled
OK) - it managed "<px" into the XML archive then failed (see below for
file). Bus error can mean a number of things on our board, but usually
an alignment problem.
Anyone any idea where I should look to sort this out?
XML output (starts to serialise pointer on last line):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="3">
<temp class_id="0" tracking_level="0" version="0">
<Name>Message1</Name>
<Filename class_id="1" tracking_level="0" version="0">
<path>/home/jhughes/msg.xml</path>
</Filename>
<Panels class_id="2" tracking_level="0" version="0">
<count>1</count>
<item class_id="3" tracking_level="0" version="1">
<px</boost_serialization>
James
This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.
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