File IO with objects stored in an STL List

As the title suggests, I'm looking to load/save my objects to and from a text file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class aircraft{
public:
        string name;
        int registration;
        string manufacturer;
        int serial;
        string productionDate;
        string owner;
        string stdInspection;
        string extraInspection;
};

class fixedWing: public aircraft{
public:
        int minSpeed;
        int maxSpeed;
        int maxClimbRate;
};

class helicopter: public aircraft{
public:
        int maxSpeed;
        int maxClimbRate;
};


The objects are all from the child classes helicopter and fixedWing from above.

What is the simplest method of file IO for these, baring in mind they are stored using the STL list!?
There isn't a "simple" solution. At a minimum, you need to be able to know what type the data
is when you read it back (is it a fixedWing? a helicopter? etc).

I'd suggest looking at boost::serialization.
Topic archived. No new replies allowed.