Hi all,
I'm new to BOOST and need help with this kind of problem of pointers serialization:
class A{
public:
A(int *anInt):m_pi(anInt){}
~A(){}
private:
int *m_pi;
};
class B{
public:
B(int *anInt):m_a1(anInt),m_a2(anInt){}
~B(){}
private:
A m_a1;
A m_a2;
};
int main()
{
int i=1;
B b(&i);
//serialize b
i=2;
//serialize b
//de-serialize b expected i = 1 and b.m_a1=b.m_a2=1
//de-serialize b expected i = 2 and b.m_a1=b.m_a2=2
}
Now, assuming that there are serialization functions for class A and B I'd like to serialize object b swice with track never so that when de-serializing b I'd like b to contain a pointer to the location of i. The problem is that when I de-serializing b I notice that b doesn't pointer to the location of i anymore but to another location.
I need this for serializing of communication, so I need to save all the data trough a pointer and read the data back step by step for preprocessing to the same location in the memory.
Is there anything I can do to overcome this problem with pointers?
Thank you in advance, Anna.
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail.