Boost logo

Boost Users :

Subject: [Boost-users] [serialization] can load_construct_data() access private members?
From: Igor R (boost.lists_at_[hidden])
Date: 2009-09-15 14:02:08


Hello,

How to grant load_construct_data() the permission to access private
members of the serializable class?

friend class ::boost::serialization::access; // doesn't help
template<class Archive> friend void
::boost::serialization::load_construct_data(Archive &ar, MyObj *t,
const unsigned int file_version); // doesn't compile with MSVC9.0SP1

One of my classes can be created with a static function only:

class Foo
{
public:
  shared_ptr<Foo> create(Arg a)
  {
    shared_ptr<Foo> self(new Foo(a));
    self->init();
    return self;
  }

private:
  Foo(Arg a);
  void init();
};

I try to simulate this behavior in load_construct_data() function.

Thanks.


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