Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-10-29 22:16:44


the package includs test_derived_class.

How does your example differ from that one?

RObert Ramey

Hugh Hoover wrote:
> more info:
>
> On Oct 27, 2007, at 3:36 PM, Hugh Hoover wrote:
>
>> I have a curious problem that's just sprung up, after changing from
>> using plain-old-pointers to using boost::shared_ptrs internally in my
>> data structures (stl hash_map and map)
>> The problem is that while the XML archive works correctly, both text
>> and binary fail (they all used to work).
>>
>> This is using gcc 4.0.1 on darwin and VC8 on windows, boost version
>> is
>> 1.34.1
>>
>> The failure occurs while unserializing an archive, specifically when
>> trying to read back a shared_ptr to an already unserialized object.
>> In the archive, it shows the object (pointer) as an object_reference
>> (the same reference id in XML and text). While the XML version reads
>> the pointer back correctly, the text version fails and returns NULL.
>> I have not determined the exact reason why the text version fails (it
>> doesn't throw, just returns NULL). The serialization does not appear
>> to have any problems.
>
> The proximate cause of the problem is in void_upcast, which does not
> find a pre-registered pair of types matching the base and derived
> types passed in from load_pointer_type::invoke. I'm having a hard
> time understanding how that could be... I've called
> void_cast_register for the type pair, so it SHOULD be registered -
> and the xml_iarchive was able to reconstruct the object properly.
>
> Any suggestions?


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