Boost logo

Boost :

From: George M. Garner Jr. (gmgarner_at_[hidden])
Date: 2005-04-12 07:51:13


Robert,

A comment in interface_oarchive.hpp states that
interface_oarchive<Archive>::This() is supposed to return the a pointer to
the most derived class. Actually, it gives you a pointer to the "Archive"
template parameter which may or may not be the most derived class, depending
on how your internal "invoke" plumbing resolves the type. In the following
case I was able to get the most derived class only by overriding both
operator<<(const T & t) and save_override()(using VC2k3):

class fau_xml_woarchive :
public boost::archive::xml_woarchive
{
public:
    [...]
    template<class T>
    void save_override(const ::boost::serialization::nvp<T> & t, int i)
    {
        save_start(t.name());
        boost::archive::save(*this, t.value());
        save_end(t.name());
    }
    template<class T>
    _Mytype& operator<<(const T & t)
    {
        save_override(t, 0);
        return *this;
    }
    [...]
};

Was that your intention?

Regards,

George.


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