views:

212

answers:

5

I'm needing a fast method to read and store objects with pointers and pointers to pointers in xml files in c++ . Every object has it's own id , name , and class type.

+1  A: 

You can't do it for pointers, you'll need to define some other method of identifying objects - like GUIDs or some other unique identifiers. In many cases you can just store the objects themselves instead of pointers.

sharptooth
+3  A: 

You should build a map of pointers to IDs as you serialise your data.

rikh
+1  A: 

Have you checked out boost::serialize?

I'm pretty sure that it automatically does one level of pointer indirection, and it is capable of writing a "form" of xml.

Richard Corden
+1  A: 

I've tried boost ,but for size of my project it's too big ( it's big , but it has high simplicity about 4-5 classes )

red777
A: 

you should stop doing such things they can harm your eyes