Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-23 09:22:19


I'm completely at loss how to serialize classes which use the pimpl idiom.
What I have is:

    class BlockFormula {
    public:
        [snip]
    private:
        struct data;
        boost::scoped_ptr<data> m_data;
    };

The "data" class is defined in cpp file. I can't write serialization method of
the form:

    template<class Archive>
    void serialize(Archive& ar, unsigned version)
    {
        ar & *m_data;
    }

since "data" is incomplete type at the point where this "serialization" is
seen. I'd rather not hardcode the type of archieve, as in

    void serialize(boost::archive::text_oarchive& ar, unsigned version);
    // definition in cpp file, where "data" definition is visible.

So, what's the solution?

TIA,
Volodya


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