上一页 1 ··· 50 51 52 53 54 55 56 57 58 ··· 66 下一页
摘要: //doc_anonymous_mutex_shared_data.hpp#include struct shared_memory_log{ enum { NumItems = 100 }; enum { LineSize = 100 }; shared_memory_log()... 阅读全文
posted @ 2014-05-14 01:45 zzyoucan 阅读(1876) 评论(0) 推荐(0) 编辑
摘要: 发送端:#include #include #include using namespace std;#include #include #include using namespace boost::interprocess;int num = 0;mapped_region *mp_r;void... 阅读全文
posted @ 2014-05-13 21:16 zzyoucan 阅读(607) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;void funa(int arg1, string arg2){ cout fun; fun = std::bind(&funa, std::placeholders::_1, std::p... 阅读全文
posted @ 2014-05-11 22:10 zzyoucan 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include using namespace std;struct MyStruct{ string stru; int ... 阅读全文
posted @ 2014-05-11 18:41 zzyoucan 阅读(3073) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-05-11 14:02 zzyoucan 阅读(512) 评论(0) 推荐(0) 编辑
摘要: stringstream本身的复制构造函数是私有的,无法直接用,于是带来了一些复杂的问题网上,流传着几种办法,如streamA.str(streamB.str()),但这种办法,复制的仅仅是初始化时的string会在以下这种情况下暴露出问题: stringstream s1("123aaa")... 阅读全文
posted @ 2014-05-11 11:13 zzyoucan 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 在编写应用程序时,我们经常要使用到字符串。C++标准库中的和为我们操作字符串提供了很多的方便,例如:对象封装、安全和自动的类型转换、直接拼接、不必担心越界等等。但今天我们并不想长篇累牍得去介绍这几个标准库提供的功能,而是分享一下stringstream.str()的一个有趣的现象。我们先来看一个例... 阅读全文
posted @ 2014-05-11 10:49 zzyoucan 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 转义字符:不可打印的和特殊意义的字符如单引号、双引号和反斜线,那这样的字符如何表示呢,就是转义字符换行符 \n 水平制表符\t纵向制表符 \v 退格符 \b回车符 \r 进纸符 \f报警(响铃)符 \a 反斜线 \\疑问号 \? 单引号 \'双引号 \"如何字符都可以转换成转义字符的格式\ooo--... 阅读全文
posted @ 2014-05-10 00:43 zzyoucan 阅读(834) 评论(0) 推荐(0) 编辑
摘要: 1.把一个 const 对象的地址赋给一个普通的、非 const 对象的指针也会导致编译时的错误:const double pi = 3.14;double *ptr = π // error: ptr is a plain pointerconst double *cptr = π /... 阅读全文
posted @ 2014-05-09 02:08 zzyoucan 阅读(170) 评论(0) 推荐(0) 编辑
摘要: const string &shorterString(const string &s1, const string &s2){return s1.size() < s2.size() ? s1 : s2;}inline const string &shorterString(const strin... 阅读全文
posted @ 2014-05-09 00:53 zzyoucan 阅读(284) 评论(0) 推荐(0) 编辑
上一页 1 ··· 50 51 52 53 54 55 56 57 58 ··· 66 下一页