Boost logo

Boost Users :

Subject: [Boost-users] [Serialization]: compiler error when registering derived class
From: Mccall, Kurt E. (JSC-EG411) (kurt.e.mccall_at_[hidden])
Date: 2015-06-18 15:17:14


I'm embarrassed to to ask this, but maybe someone could interpret this strange compiler error for me: I am registering a
derived class everywhere that it is archived through a base class pointer:

class MyDerivedClass : public MyBaseClass { … };

class AnotherClass
{
    MyBaseClass *p;
    …
    void serialize(Archive &ar, unsigned int)
    {
        ar.register_type(static_cast<MyDerivedClass *>(NULL)); // compiler error here
        …
       ar & p;
}

At the line above, the error is

error: no matching function for call to ‘boost::archive::xml_oarchive::register_type(AnotherClass:serialize (Archive&, unsigned int) [with Archive = boost::archive::xml_oarchive]::MyDerivedClass*)’

Does the complier think that MyDerivedClass is a member of boost::archive::xml_oarchive?

Im using Boost 1.57 and gcc 4.4.7. Thanks.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net