boost::archive::binary_iarchive
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <queue>
#include <boost/serialization/vector.hpp>
using namespace std;
struct MyStruct
{
string stru;
int len;
};
queue<MyStruct> q_stu; void funa()
{
MyStruct ms;
int ret = ;
vector<int> vc;
vc.push_back();
vc.push_back();
stringstream ss;
boost::archive::binary_oarchive oa(ss);
oa << ret << vc;
ms.stru = ss.str();
ms.len = ss.str().size();
q_stu.push(ms);
} void funb(const char* arg, int len)
{
std::stringstream r_ss;
r_ss.write(arg, len);
boost::archive::binary_iarchive ia(r_ss);
q_stu.pop();
int ret;
vector<int> vct;
ia >> ret >> vct;
} int main()
{
funa();
funb(q_stu.front().stru.c_str(), q_stu.front().len);
getchar();
return ;
}
boost::archive::binary_iarchive的更多相关文章
- boost::archive::text_oarchive
Serialization的中文解释是“串行化” .“序列化”或者“持久化” ,就是将内存中的对象保存到磁盘中,等到程序再次运行的时候再读取磁盘中的文件恢复原来的对象.下面来看一个简单的例子: #in ...
- C++ | boost库 类的序列化
是的,这是今年的情人节,一篇还在研究怎么用的文章,文结的时候应该就用成功了. 恩,要有信心 神奇的分割线 不知何时装过boost库的header-only库, 所以ratslam中的boost是可以编 ...
- boost序列化
#include <iostream> #include <boost/serialization/serialization.hpp> #include <boost/ ...
- Boost Asioserver使用
今天主要想说道说道boost里面的网络通信库怎样设计和使用,由于近期一直在和网络一起工作,大数据处理和机器学习都离不开最后使用网络进行上线部署.先看看所有的源码吧. #include <cstd ...
- 如何在C++中使用boost库序列化自定义class ?| serialize and deserialize a class in cpp with boost
本文首发于个人博客https://kezunlin.me/post/6887a6ee/,欢迎阅读! serialize and deserialize a class in cpp Guide how ...
- share干什么的
share到底干什么的 //--------------------打开GameServer,share中加载------------------------- .加载nBodyID //玩家的nBo ...
- Visual Studio 2013 boost
E:\Visual Studio 2013\install\VC\bin\amd64>E:\IFC\boost_1_56_0_vs2013'E:\IFC\boost_1_56_0_vs2013' ...
- Visual studio 2017编译 boost
下载: https://www.boost.org/ 或者 https://dl.bintray.com/boostorg/release/1.66.0/source/ 下载完成以后解压到自己想要 ...
- Boost的Serialization和SmartPoint搭配使用
准确来说,这篇博文并不是译文,而是一篇某个网页中代码改写而来.原文章中的代码存在几处严重错误,网页又不提供留言功能(不是没有而是一个没有留言功能的留言板).4年过去了,作者对这些错误不更正让人无法接受 ...
随机推荐
- 最接近WeChat的全屏自定义相机(Custom Camera)
代码地址如下:http://www.demodashi.com/demo/13271.html 一.需求 最接近WeChat的全屏自定义相机(Custom Camera),拍照和预览都是全屏尺寸.使用 ...
- jenkins部署前端node项目实例
Jenkins 分发文件用到rsync命令 在 /etc/passwd中 修改 jenkins 为 /bin/bash jenkins:x:494:494:Jenkins Automation S ...
- LaTeX 中使用三级标题
需要在导言区加入命令:\setcounter{secnumdepth}{4} 而后: \section{一级标题} \subsection{二级标题} \subsubsection{三级标题}
- c# 读取文件流
1.获取文件路径 2.编写读取路径文件信息 private string ReadFileStream(string filePath) { string st ...
- Build System 和Test Framework overview总结
良好的自动化系统可以帮助Dev/Tester快速发现product/test code issue. 正好上一个项目结束,上个项目在自动化系统上面做得非常好.从产品开始时半年release一次到后面每 ...
- c#中abstract、override、new、virtual、sealed使用
abstract 修饰类名为抽象类,修饰方法为抽象方法.如果一个类为抽象类,则这个类智能是其他某个类的基类.抽象方法在抽象类中没有函数体.抽象类中的抽象方法是没有方法体的,继承其的子类必须实现 ...
- CentOS7 安装lua环境(我是在mysql读写分离用的)
下载地址:http://www.lua.org/download.html 安装方法: 依次执行以下命令: curl -R -O http://www.lua.org/ftp/lua-5.3.1.ta ...
- TomEE
https://tomee.apache.org/ Apache TomEE, pronounced "Tommy", is an all-Apache Java EE 6 Web ...
- CSU 1335: 高桥和低桥 (二分查找,树状数组)
Description 有个脑筋急转弯是这样的:有距离很近的一高一低两座桥,两次洪水之后高桥被淹了两次,低桥却只被淹了一次,为什么?答案是:因为低桥太低了,第一次洪水退去之后水位依然在低桥之上,所以不 ...
- ITDB系统搭建及实时备份
ITDB系统搭建及实时备份 ITDB简介 ITDB一款来自希腊的开源IT资产管理系统,它是基于Web的IT资产信息管理系统.对于那些IT设备较多而又缺少管理IT资产信息工具的公司,ITDB是一个不错的 ...