Boost logo

Boost Users :

Subject: Re: [Boost-users] Assertion `__null != bpos' failed in /inclu de/boost/archive/detail/oserializer.hpp:436
From: ktomaszewski_at_[hidden]
Date: 2011-01-21 04:25:05


Yesterday night I saw another weird thing:

1. In constructor of my archive class SafeBinOutArchive, which is derived from boost::archive::binary_oarchive_impl, I register the derived class to be serialized by calling method:

template <class Archive>
void RegisterDerivedClasses(Archive& ar) {
    ar.register_type((Borg::PrefsMachineHash*)0);
}
SafeBinOutArchive::SafeBinOutArchive(std::ostream & os)
: base(os, boost::archive::no_header) {
    RegisterDerivedClasses(*this);
}

2. IT DOESN'T HELP, so following piece of code triggers the mentioned assert:

    boost::shared_ptr<Borg::AHash> pHash(new Borg::PrefsMachineHash);
    std::ostringstream os;
    Borg::SafeBinOutArchive ar(os);
    //ar.register_type((Borg::PrefsMachineHash*)0);
    ar & pHash;

3. BUT IF I UNCOMMENT the commented line in the above code, IT WORKS!

How is this possible?!?!?
:-\


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