|
Boost Users : |
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2007-11-08 11:30:51
Oliver Kania wrote:
> Hello and thx
> I guess that means I cannot change class state in my save method.
> That is what I need ! Is there any way around it ?
... Please don't top post!
> ===================================================
> template<class Archive>
void save( Archive &ar, unsigned int version) const {
replace these:
> m_offlineMode = true;
> // we cannot load more when offline --> always cachedAll
> bool oldCachedAll = m_CachedAll;
> m_CachedAll = true;
> ar & m_CachedAll;
> ar & m_offlineMode;
with:
ar << true;
ar << true;
> // do not serialize the lock -- use the default
> constructor.
> // we assume that no iterators that lock the cache do
> exist
> when serializing.
> // ar & m_Lock;
> ar & m_LookupId;
> ar & m_LookupName;
> ar & m_SequenceNumber;
> //reset old state for the case we want to continue
> working
remove these:
> m_CachedAll = oldCachedAll;
> m_offlineMode = false;
> }
then there's no need for mutable nor const_cast.
Jeff Flinn
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