Boost logo

Boost Users :

Subject: Re: [Boost-users] error in boost_serialization of static variable
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-03-24 12:22:15


ashish srivastava wrote:
> Hello
> I am having some problem in executing the code of
> boost_serialization. I'm trying to serialize the static class member
> variable. For that purpose I have wrapped the int static variable to
> tracked_int static variable. Please find the code attached with this
> mail.
>
> This is how I'm running the code and getting the segmentation fault.
> ---------------------------------------------------------
> $ g++ test_serialization_linklist.cpp -l boost_serialization
> $ ./a.out
> do u want to continue adding more nodes into the link list (y/n) ??y
> do u want to continue adding more nodes into the link list (y/n) ??y
> do u want to continue adding more nodes into the link list (y/n) ??n
> 5
> 6
> 6
> 6
>
> the number of nodes present in the list = 4
> Segmentation fault
>

I looked at the program.

you save one instance through a pointer

 ar & start

you load one instance though a pointer

ar & newg

then you try to loop starting at newg. This won't work as there is
only one pointer.

Try using std::list rather than your own "list" class.

Robert Ramey



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