Boost logo

Boost Users :

Subject: [Boost-users] [serialization] overloading load_construct_data: no accessible constructor at all
From: Griffin Howlett (griff.howl_at_[hidden])
Date: 2011-08-13 07:34:39


Hey, so I'm using the boost::serialization library, and I'm trying to
override how a class is constructed, since it has no default constructor.
This is demonstrated
here<http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/serialization.html#constructors>.
To me it appears the function ONLY takes the `class* t` and then sets it to
point to a newly constructed object. If I'm wrong, this is definitely the
source of my error.

However, the only way to construct my class is by using another classes
`create()` function, meaning I need to stray from the code in the example
(this is stated in the boost::serialization namespace):
`::new(t)my_class(attribute);`

I tried simply calling the create function and setting `t` equal to the
returned pointer, but this doesn't seem to work because right after the
`load_construct_data function`, and in the `serialization function`, the
given `myClass&` is not the same as what I set 't' to.

*How do I do whatever ::new(t) is doing so the object created using the
create function follows through into the serialize/other functions?*

  [1]:
http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/serialization.html#constructors



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