Boost logo

Boost Users :

From: Anis (mighty_ernie_at_[hidden])
Date: 2008-05-22 12:10:01


Thanks for the prompt reply. Yes, that was it. I forgot that internal
state inside the archive may be changing after serialization.

What about the private nature of get_library_version()? I can't invoke the
method on a polymorphic_binary_iarchive because it's private, whereas it's
public in a binary_archive. This isn't a big issue, I can certainly work
around it, it's more of a personal curiosity.

Thanks again,

Anis

"Robert Ramey" <ramey_at_[hidden]> wrote in message
news:g14420$86p$1_at_ger.gmane.org...
> 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