#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的更多相关文章

  1. boost::archive::text_oarchive

    Serialization的中文解释是“串行化” .“序列化”或者“持久化” ,就是将内存中的对象保存到磁盘中,等到程序再次运行的时候再读取磁盘中的文件恢复原来的对象.下面来看一个简单的例子: #in ...

  2. C++ | boost库 类的序列化

    是的,这是今年的情人节,一篇还在研究怎么用的文章,文结的时候应该就用成功了. 恩,要有信心 神奇的分割线 不知何时装过boost库的header-only库, 所以ratslam中的boost是可以编 ...

  3. boost序列化

    #include <iostream> #include <boost/serialization/serialization.hpp> #include <boost/ ...

  4. Boost Asioserver使用

    今天主要想说道说道boost里面的网络通信库怎样设计和使用,由于近期一直在和网络一起工作,大数据处理和机器学习都离不开最后使用网络进行上线部署.先看看所有的源码吧. #include <cstd ...

  5. 如何在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 ...

  6. share干什么的

    share到底干什么的 //--------------------打开GameServer,share中加载------------------------- .加载nBodyID //玩家的nBo ...

  7. 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' ...

  8. Visual studio 2017编译 boost

    下载: https://www.boost.org/   或者 https://dl.bintray.com/boostorg/release/1.66.0/source/ 下载完成以后解压到自己想要 ...

  9. Boost的Serialization和SmartPoint搭配使用

    准确来说,这篇博文并不是译文,而是一篇某个网页中代码改写而来.原文章中的代码存在几处严重错误,网页又不提供留言功能(不是没有而是一个没有留言功能的留言板).4年过去了,作者对这些错误不更正让人无法接受 ...

随机推荐

  1. 给第三方dll加上强命名的方法[C#]

    在VS.NET 的命名行窗口下,输入如下的代码. 1 ,生成一个KeyFile sn -k keyPair.snk 2, 得到程序集的MSIL ildasm SomeAssembly.dll /out ...

  2. CSS3使用盒模型实现三栏布局

    本篇文章由:http://xinpure.com/css3-box-model-to-implement-a-three-column-layout/ 使用 Position 绝对定位也是可以实现三栏 ...

  3. gulp入门学习教程(入门学习记录)

    前言 最近在通过教学视频学习angularjs,其中有gulp的教学部分,对其的介绍为可以对文件进行合并,压缩,格式化,监听,测试,检查等操作时,看到前三种功能我的心理思想是,网上有很多在线压缩,在线 ...

  4. checkbox 全选操作

    <html> <head></head> <body> <div id="places"> <input type ...

  5. 文件操作FileStream,Log

    1.关于读写文件,犯的一个低级错误,平常代码拷贝习惯了,就像电脑用多了会提笔忘字一样,所以平常还是要多多用心才好. 这段代码的意图是在文件中写入数据,如果原文件不存在,则先新建. 事实上,当真的执行了 ...

  6. js一点代码备用

    加载次序 .1等页面加载完毕 <script type="text/javascript"> jQuery(window).load(function(){ ... } ...

  7. php-fig组织fig-standards的一些标准

    参考: http://psr.phphub.org/ https://github.com/php-fig/fig-standards https://github.com/PizzaLiu/PHP- ...

  8. neo4j使用笔记

    #coding:utf- __author__ = 'similarface' # 安装驱动:pip install neo4j-driver from neo4j.v1 import GraphDa ...

  9. java创建web服务

    java开发web服务的方法有很多,但是常用的就两种一种是开发时用,一种发布时用.开发时使用jax-ws注解的方式开发调试,发布时使用tomcat. 注解方式: http://www.cnblogs. ...

  10. Python中集合类型(set)学习小结

    set 是一个无序的元素集合,支持并.交.差及对称差等数学运算, 但由于 set 不记录元素位置,因此不支持索引.分片等类序列的操作. 初始化 复制代码代码如下: s0 = set()d0 = {}s ...