b) use BOOST_STRONG_TYPE to make an integer type that is tracked.
Okay. The code snippet you gave me worked great.
However, I am now experiencing what I hope is the final problem.
Basically, I have a recursive data structure A, which contains
pointers of type boost::smart_pointer<A>.
Could you please show me how to get the follow code snippet to work?
I should say that I'm really appreciative for all your help.
--------
#include <iostream>
#include <fstream>
#include
#include
#include
#include
#include
#include
#include
#include
class A;
BOOST_STRONG_TYPEDEF(boost::shared_ptr<A>, Aptr)
class A {
public:
friend class boost::serialization::access;
template<class Archive> void serialize(Archive& ar, const
unsigned int version) {
ar & aptr;
}
private:
Aptr aptr;
};
template <class Archive>
void serialize(Archive &ar, Aptr &aptr, const unsigned int version) {
ar & static_cast(aptr);
}
int main() {
std::ofstream ofs("archive");
boost::archive::text_oarchive oa(ofs);
A a;
oa << a;
Aptr aptr;
oa << aptr;
return 0;
}
--------
Thanks!
Joseph
--
http://www.cs.nyu.edu/~turian/