Boost logo

Boost Users :

Subject: Re: [Boost-users] Assertion `__null != bpos' failed in /inclu de/boost/archive/detail/oserializer.hpp:436
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-01-20 18:36:39


ktomaszewski_at_[hidden] wrote:
> I'm using Boost v. 1.44 on Linux and gcc version 4.4.1 (Ubuntu
> 4.4.1-4ubuntu9)
>
>
> I'm trying to serialize derived class object through base class
> shared-pointer. After reading tons of documentation from
> www.boost.org and checking all posible solutions (with macros) I
> turned to the simplest one which still doesn't work.
>
>
> 1) I register derived class with the archive by the code:
>
>
> ar.register_type((PrefsMachineHash*)0); // PrefsMachineHash is a
> class derived from AHash class
>
>
> 2) I try to serialize boost::shared_ptr<AHash> object by the code:
>
>
> ar & ptr; // ptr is of type: boost::shared_ptr<AHash>
>
>
>
> After all, the assert (oserializer.hpp:436, assert(NULL != bpos))
> triggers. The stack-trace is below. What is really weird is that on
> the small example everything works correctly. How is this possible?
> AFTER 7 HOURS I GAVE UP. ANY HELP, please?

you example uses :

        std::ostringstream os;
        Borg::SafeBinOutArchive ar(os);

if rather than you use the following, what happens?

        std::ofstream os("filename", ios::binary);;
        boost::archive::binary_oarchive ar(os);

Robert Ramey


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