|
Boost Users : |
Subject: [Boost-users] [serialization - newbie] serializing/deserializing singleton class objects
From: Soumen (soumen78_at_[hidden])
Date: 2009-08-04 03:03:57
Hi,
This is query was posted as part of different question. Doing a fresh post
with a new topic as earlier one didn't fetch any response - assuming it may
got lost in the original context.
I'm trying to serialize/deserialize singleton class objects. My code is
similar to following for save/restore:
void save(boost::archive::binary_oarchive &archive)
{
MyData *data = MyData::instance();
if (data) archive << data;
}
void restore(boost::archive::binary_iarchive &archive)
{
MyData::cleanup();
archive >> (MyData *) MyData::instance();
}
My save function works - stores data on disk. But the restore function
doesn't compile. I get error like following:
error: no match for âoperator>>â in âarchive >> (MyData *)
MyData::instance()â
/boost/1_35_0/include/boost/archive/detail/interface_iarchive.hpp:62: note:
candidates are: Archive&
boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T
= MyData*, Archive = boost::archive::binary_iarchive]
If I change the 2nd line of restore function in following way, the error
message almost remains same:
MyData *inst = MyData::instance();
archive >> (MyData *) inst;
Please guide me what I'm doing wrongly.
Regards,
~ Soumen
-- View this message in context: http://www.nabble.com/-serialization---newbie--serializing-deserializing-singleton-class-objects-tp24803268p24803268.html Sent from the Boost - Users mailing list archive at Nabble.com.
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