I'm new to C++ and how do i serialize the struct having shared pointer and template . Below is sample code.
#pragma once
#include <boost/serialization/access.hpp>
#include <boost\serialization\string.hpp>
#include <boost\serialization\shared_ptr.hpp>
//Mydata.hpp file
namespace mydata
{
struct MyData
{
std::string name;
std::string type;
std::shared_ptr<MyInfo> myref;
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive &ar, const unsigned int vs)
{
ar & name;
ar & type;
ar & myref;
}
}
}
now how do i implement in the corresponding Mydata.cpp file for shared pointer ?