[serialization] can load_construct_data() access private members?
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.
Solved. It turns out that load_construct_data() is ADL-enabled, so it can be defined in the namespace of the object, instead of ::boost::serialization.
participants (1)
-
Igor R