Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-05-22 12:38:43


An archive can't be const as it is changed when something is serialized to
it

try:

    void foo(boost::archive::polymorphic_iarchive& ar)
    {
        ar >> boost::serialization::make_nvp("typeName", *typePtr);
        ...
    }

Robert Ramey

Anis wrote:
> I'm seeing the following error when trying to serialize from a
> polymorphic_iarchive. I'm new to boost::serialization, so I was
> hoping somebody could shed some light on what I was doing wrong? I
> tried googling and searching the archives, but didn't find anything
> yet.
>
> error C2678: binary '>>' : no operator found which takes a left-hand
> operand of type 'const boost::archive::polymorphic_iarchive' (or
> there is no acceptable conversion)
> c:\boost\include\boost-1_35\boost\archive\detail\interface_iarchive.hpp(62):
> could be 'Archive
> &boost::archive::detail::interface_iarchive<Archive>::operator
> >><const boost::serialization::nvp<T>>(const
> boost::serialization::nvp<T> &)'
>
> The code in question is essentially:
> virtual void foo(const boost::archive::polymorphic_iarchive& ar)
> {
> ar >> boost::serialization::make_nvp("typeName", *typePtr);
> ...
> }
>
> Also, it appears as though get_library_version() is private for
> polymorphic_iarchive_dispatch. I'm confused, isn't it public
> elsewhere? I was hoping to have access to it. I reckon there's a
> reason behind this, so I'm just curious as to why it's private.
>
> 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