boost serialize序列化

boost序列化

  

#ifndef FND_SERI_H
#define FND_SERI_H #include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp> template <typename T>
std::string seriliaze(const T &obj)
{
std::stringstream ss;
boost::archive::text_oarchive oa(ss);
oa & obj;
return ss.str();
} class SBindName
{
private:
friend class boost::serialization::access; template <class Archive>
void serialize(Archive &ar,const unsigned int version)
{
ar & m_bindName;
} std::string m_bindName;
public:
SBindName(std::string name): m_bindName(std::move(name)){}
SBindName(){}
const std::string &bindName() const { return m_bindName;}
};
#endif //use
//outbuf = seriliaze(SBindName(std::move(name)));
//
//SBindName info;
//std::stringstream ss(std::string(*******));
//boost::archive::text_iarchive oa(ss);

  

上一篇:强制不使用“兼容性视图”的HTML代码(转)


下一篇:关于写SpringBoot+Mybatisplus+Shiro项目的经验分享二:问题1