Boost::Serialization has builtin support for boost::shared_ptr<>
.
Is there a way to use this support for std::tr1::shared_ptr<>
too?
Is it possible to cast from std::tr1::shared_ptr<>
to boost::shared_ptr<>
?
Boost::Serialization has builtin support for boost::shared_ptr<>
.
Is there a way to use this support for std::tr1::shared_ptr<>
too?
Is it possible to cast from std::tr1::shared_ptr<>
to boost::shared_ptr<>
?
A casting will not be possible as implementations differ. Also creating an instance of the one shared_ptr type with the value returned from get() on the other shared_ptr type will not work correctly as the reference countings will go to 0 at different points in your code which leads to deletion of the object before the last use of it. I am not an expert of boost::serialization but as the interfaces of std::tr1::shared_ptr<> and boost::shared_ptr<> are nearly identical it is very likely that you can just clone the serialization/deserialization code of boost::shared_ptr<> and only have to replace the namespace of the shared_ptr.
© 2022 - 2024 — McMap. All rights reserved.
boost::shared_ptr
in the first place ? – Genitourinarytypedef boost::shared_ptr MySharedPtr
, so your code factically would be not boost-dependent, but typedef-dependent. You could change both serialization library and typedefs in the future. – Touslesmois