Boost logo

Boost :

From: Asger Alstrup Nielsen (alstrup_at_[hidden])
Date: 2002-02-28 07:57:54


> > Jens' describe() scheme is fine, but it doesn't extend to attributes well,
> > and doesn't handle versioning (it makes things assymetrical.)
>
> I haven't looked at Jens' scheme.

In as far as Jens' scheme is comparable to XTL, versioning is trivial:

class Foo {

int oldMember; // Only in version 0
int newMember; // In version 0 and 1

template<class S>
void serialize(S & s) {
    int version = 1;
    s.stream(version);

    switch(version) {
    case 0:
        // code for reading old version 0 data
        s.serialize(oldMember);
        newMember = defaultValue;
        break;
    case 1:
        // code for both reading & writing version 1
        s.serialize(oldMember);
        s.serialize(newMember);
        break;
    default:
        throw "Unsupported version";
    }
}

};

Greets,

Asger Alstrup Nielsen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk