
Hi Daniela,
On 10/10/2011 11:10, Daniela Lambertz wrote: Hello,
I have a class Energy which is first serialized as a vector of pointers. Then, it is serialized multiple times as a non-pointer attribute. Here, the issue occurs. The first non-pointer Energy is serialized normally and all following non-pointer Energies are serialized as pointers to the first one. This leads to wrong values.
You don't give details on the reason why you (try to) use the lib in this way but it looks a design error (see the "a) don't do that" by robert) maybe you could investigate the use of some shared pointers and reimplement part of your work. a workaround that *could* work is to use 2 archives to confine the memory tracking mechanism in 2 independant serialization regions: - the first one for the pointer-ed stuff - the other one for the non-pointer-ed one but it means some additionnal management and care. however, re-design should be considered first. regards frc --
When I tried another class which is not serialized as a pointer anywhere in the code, it worked fine. (I'm using non-intrusive serialization and I split the serialize-method into save and load.)
Now in the Serialization tutorial, I found that the adresses of objects with the tracking trait "track_selectively" are tracked if "an object of this type is anywhere in the program serialized through a pointer". Can this be the reason for my Energy-problem? If yes, is there a way to avoid this behaviour?
So far, it only works correctly if I transform this Energy attribute into a pointer in the save-method and serialize the pointer. But as my program is still in development, the problem might also turn up with other classes in the future and so it would be nice to have a general solution for this.
Please tell me, if you need example code.
Hope you can help me. Thanks in advance!
Best regards Daniela Lambertz
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! *http://f.web.de/?mc=021192*
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- François Mauger Groupe "Interactions Fondamentales et Nature du Neutrino" NEMO-3/SuperNEMO Collaboration LPC Caen-CNRS/IN2P3-UCBN-ENSICAEN Département de Physique -- Université de Caen Basse-Normandie Adresse/address: Laboratoire de Physique Corpusculaire de Caen (UMR 6534) ENSICAEN 6, Boulevard du Marechal Juin 14050 CAEN Cedex FRANCE Courriel/e-mail: mauger@lpccaen.in2p3.fr Tél./phone: 02 31 45 25 12 / (+33) 2 31 45 25 12 Fax: 02 31 45 25 49 / (+33) 2 31 45 25 49