views:

131

answers:

2

how to make data structures(like trees, graphs ) persistent in c++?

+3  A: 

In general, you will need to serialise the structure so that you can write it to a file or a database. If you have a custom structure, then you will need to write the method to serialise and deserialise (i.e. write out and read in the structure). Otherwise, if you have used a structure from a library, there may already be (de)serialisation methods.

eg. A linked list might serialise as a string like so: [1,2,3,4,5]

ar
+4  A: 

Try Google Protocol Buffers or the Boost serialization library.

Ates Goral