|
Boost Users : |
Subject: Re: [Boost-users] [Serialization: Newbie] Compilation Problem Text Archive
From: Soumen (soumen78_at_[hidden])
Date: 2009-08-03 08:32:06
Hi Robert,
I've tried this - but I get errors later on with invalid const conversion in
the serialize function of TableMgr for each members. Looks like I need to
cascade const changes to all the classes. At this point that's overkill for
me since my idea to try with text archive was to verify that save is
happening correctly. So I've decided for now to proceed with restore routine
with binary archive itself.
Now, how do I need to call this with TableMgr as this is singleton with
return value of pointer type (internal implementation is using non-pointer
static object and instance() returns address of it)?
None of following approaches compiles
//Assume my input archive object is iarchive
1)
TableMgr *tblMgr = TableMgr::instance();
iarchive >> tblMgr;
2)
TableMgr *tblMgr = TableMgr::instance();
iarchive >> (TableMgr&)(*tblMgr); // with output archive similar approach
works
3)
iarchive >> TableMgr::instance() // similar usage works in some other code
when instance() returns ref
// I guess this is equivalent of (1) anyway
If these approaches are correct, I think some problem must be there with
serialize() methods. I can concentrate there in that case. If these
approaches are incorrect, please guide me how should I use it.
Thanks,
~ Soumen
Try
const TableMgr *tblMgr = TableMgr::instance();
if (tblMgr) {
oarchive << tblMgr;
}
Robert Ramey
-- View this message in context: http://www.nabble.com/-Serialization%3A-Newbie--Compilation-Problem-Text-Archive-tp24754405p24789959.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