Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Serialization not building
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-10-14 19:28:12


On Wed, Oct 14, 2009 at 11:51 AM, Robert Ramey <ramey_at_[hidden]> wrote:
> OvermindDL1 wrote:
>> On Wed, Oct 14, 2009 at 1:04 AM, OvermindDL1 <overminddl1_at_[hidden]>
>> wrote:
>>> /* snip */
>>
>>
>> I also appear to have another error while trying to serialize a
>> shared_ptr:
>> I have spent about the last 4 hours changing one thing and changing
>> another and nothing I do seems to ever work.  And yes it happens with
>> different archive types and so forth.  I think I narrowed down the
>> issue to line 42 in file
>> boost\serialization\type_info_implementation.hpp but I am not certain,
>> if it is not this line directly it is something that builds it up...
>> Yes I do include the shared_ptr helper as the examples show
>> (serialization\example\demo_shared_ptr.cpp), and tried various macros
>> for registering it and so forth...
>
> Does test_share_ptr included with the package compile and run with
> your system?  If not, I would like to hear about it.  If so, check how
> your application differs from the test.

If I get some time soon I will.

On Wed, Oct 14, 2009 at 11:51 AM, Robert Ramey <ramey_at_[hidden]> wrote:
>> So any ideas why a non-virtual class/struct causes Boost.Serialization
>> to choke in a shared_ptr (but works fine as a normal pointer), but a
>> virtual one works?
>
> This might be due to trying to serialize a non-polymorphic class
> through a base class pointer.  Of course without seeing the source
> code, there's no way for anyone to know.

This is basically the class:
class User
{
public:
    User(std::string name, std::string pass)
        :name_(name)
        ,pass_(pass)
    {}
private:
    std::string name_;
    std::string pass_;
}

And it could not be serialized through a smart pointer

>
>> Also, I noticed that the tr1 containers are not supported, such an
>> unordered_set.  I created my own serializer for those, but it seems
>> odd that it is not included since it seems to contains everything else
>> from the stl, and the tr1 containers have been in Boost for quite some
>> time now.
>
> No One has done it yet.  Feel free to upload you version to the vault.

I can try to finish wrapping the rest (seemed pretty easy,
Boost.Serialization already has things to handle basically all
stl-style container types, it just was not yet exposed to the new tr1
version, but seems to work perfectly with them) and do that after
testing that they work, but it may take some time, I get free time
about once a week (last night for this week).


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