Dear Robert,
see below for a simple test program that illustrates what I'm trying to
do. This compiles with Boost 1.58, but fails on 1.53 with the error message
/opt/boost153/include/boost/serialization/access.hpp:118:11: error: no
member
named 'serialize' in 'std::__1::shared_ptr<test>'
t.serialize(ar, file_version);
I need to support Boost versions starting with 1.53. Thus I have two
options:
- do serialization of std::shared_ptr myself
- include the 1.58 boost/serialization/shared_ptr.hpp for older
Boost-versions.
What is the best way ?
Thanks and Best Regards,
Beet
/*******************************************************/
// Compile with
// g++ --std=c++11 -o sharedptr sharedptr.cpp -I /opt/boost158/include/
// -L/opt/boost158/lib -lboost_serialization -lboost_system
// on MacOS, Linux
#include <iostream>
#include <memory>
#include <sstream>
#include
beet-2 wrote
Dear Robert,
thanks a lot! Do I understand it correctly, that I could easily create my own serializer for std::shared_ptr by just (de)serializing the contained "raw" pointer and wrapping it into a std::shared_ptr in the case of de-serialization ?
No. You have to keep track of other shared pointers point
I had assumed from the question that the situation was something like:
// version 1 myclass { boost::shared_ptr m_p ... } // version 2 myclass { std::shared_ptr m_p ... };
and the question was asking how the latest version code would de-serialize older version (version 1) archives (data files)
Robert Ramey
-- View this message in context: http://boost.2283326.n4.nabble.com/serialization-std-shared-ptr-with-Boost-1... Sent from the Boost - Users mailing list archive at Nabble.com.