[serialization] Support for smart pointers?
Hi, The documentation for Boost.Serialization states that support for loading/saving pointers is fully supported out of the box. However, what if I want to use smart pointers, such a boost::scoped_ptr? Right now I believe I would have to do this: Foo* foo1; archive & foo1; boost::scoped_ptr<Foo> foo2( foo1 ); I was thinking it would be convenient to avoid the extra variable (foo1) and do this: boost::scoped_ptr<Foo> foo2; archive & foo2; Is this possible?
Never mind, I happened to stumble across the answer. I was looking through
the unit tests for Boost.Serialization and noticed that while scoped_ptr was
not used anywhere, shared_ptr was. So I check out the header files and I see
a
Hi,
The documentation for Boost.Serialization states that support for loading/saving pointers is fully supported out of the box. However, what if I want to use smart pointers, such a boost::scoped_ptr?
Right now I believe I would have to do this:
Foo* foo1; archive & foo1; boost::scoped_ptr<Foo> foo2( foo1 );
I was thinking it would be convenient to avoid the extra variable (foo1) and do this:
boost::scoped_ptr<Foo> foo2; archive & foo2;
Is this possible?
participants (1)
-
Robert Dailey