Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Runtime error in load_pointer
From: elizabeta petreska (elizabeta.petreska_at_[hidden])
Date: 2010-01-19 03:39:58


Again thank you all who helped me in this .

>>This is likely a secondary effect from some other error.
It was secondary error.

>>A complete shot in the dark but it is possible it might be the problem.

This was the problem, so it wasn't shot in the dark at all.
The problem was that my classes have the following class members :
shared_ptr<const T> , vector<const T>, vector<shared_ptr<const T>> and many
others that have const inside them. I can not remove const from these,
altghough I wish :)
I was casting const away (http://tinyurl.com/yae5stv ) for all this members
only at the point of loading, for example in many cases I was saving
vector<const T> and loading vector<T>. Now I added const cast at the point
of saving too, so saving and loading is symmetric. It seems it works Ok now,
and I hope this is the right way to solve the problem.

On Sat, Jan 16, 2010 at 12:28 PM, Richard Crossley <rdc_at_[hidden]>wrote:

> A complete shot in the dark but it is possible it might be the problem.
>
> Sometime back you showed your solution to serializing a shared_ptr<> to
> const object [1]. As you showed it, it was asymmetric in that it wrote out
> a shared_ptr<X const> whilst reading in a shared_ptr<X>. Once you add
> polymorphic types to the archive you could encounter problems similar to
> those you mention.
>
> HTH,
>
> Richard.
>
> [1] http://tinyurl.com/yae5stv
> ---
>
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of elizabeta
> petreska
> Sent: 15 January 2010 13:32
> To: Boost-users_at_[hidden]
> Subject: [Boost-users] [Serialization] Runtime error in load_pointer
>
> Hello
> I do not have small working example, and can't reduce the problem to such.
> I
> know that is impossible to say what can be the problem from the following
> information, but still
> I 'll give it a try.
> I am getting runtime error in STL ( vector is out of range error ) when
> trying to load my shared pointer.
> The runtime error happens in basic_iarchive.cpp line line 431 :
>
> cobject_id_vector[i].bpis_ptr = bpis_ptr;
>
>
> I am using boost 1.41. Anyone has seen this error and maybe knows what can
> get to it.
>
> Thanks
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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