Boost logo

Boost Users :

Subject: Re: [Boost-users] Problems using boost serializing and customconstructors
From: Allan Nielsen (a_at_[hidden])
Date: 2012-03-12 12:53:48


> This whole thing looks a little suspicious to me.
Well, it is most likely because I;m doing it completely wrong ;)
Please correct me.

> I'd have to spend considerable time looking into it.  But I'm curious why you don't
> just do the following:
> template<class Archive>
> void save(Archive &ar, const unsigned int version) const {
>    ar << data;
> }
> template<class Archive>
> void load(Archive &ar, const unsigned int version){
>    ar >> data;
> }

Because I have a shared pointer, and ( for other reasons ) I do not
want to use "shared_ptr"

So, a simplified version of my problem could look like this:

struct A {
    std::vector<unsigned> data;

struct B {
    const std::vector<unsigned> * data_ptr;

struct C {
    A a;
    std::vector<B> elements;

What would a serializing function for A, B and C look like.

Best regards
Allan W. Nielsen

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at