随笔分类 -  c++ 11

摘要:#include <vector> #include <algorithm> #include <iostream> #include <bitset> using namespace std; void print() {} template <typename T, typename... Ty 阅读全文
posted @ 2020-09-19 12:41 zzyoucan 阅读(155) 评论(0) 推荐(0) 编辑
摘要:#include #include void f(int& n1, int& n2, const int& n3){ std::cout bound_f = std::bind(f, n1, std::ref(n2), std::cref(n3)); n1 = 10; n2 = ... 阅读全文
posted @ 2015-01-05 10:09 zzyoucan 阅读(195) 评论(0) 推荐(0) 编辑
摘要:asynDBCenterasynDBCenter是GS和DBCenter之间的模块,有了他GS访问数据库就是异步的了,以前是同步的,加入某个操作很耗时那么GS就在那等待这个返回值。1.对于std::queue哪些情况要加锁,哪些不加push、pop操作100%必须加锁,front和back操作是只读... 阅读全文
posted @ 2014-09-24 22:56 zzyoucan 阅读(275) 评论(0) 推荐(0) 编辑
摘要:#include #include using namespace std;int fun(int a){ std::cout * f){ auto fun = *f; fun(1); return 1;}int main(){ std::function fu... 阅读全文
posted @ 2014-09-20 01:18 zzyoucan 阅读(150) 评论(0) 推荐(0) 编辑
摘要:啥是POD类型?POD全称Plain Old Data。通俗的讲,一个类或结构体通过二进制拷贝后还能保持其数据不变,那么它就是一个POD类型。平凡的定义1.有平凡的构造函数2.有平凡的拷贝构造函数3.有平凡的移动构造函数4.有平凡的拷贝赋值运算符5.有平凡的移动赋值运算符6.有平凡的析构函数7.不能... 阅读全文
posted @ 2014-08-18 00:39 zzyoucan 阅读(9014) 评论(0) 推荐(2) 编辑
摘要:#include #include using namespace std::placeholders;//lambda即匿名函数int main(){ int a = 10; //当return所有的返回都是一个类型就不需要指定返回值的类型,因为编译器会自动推断 //也可以指定返... 阅读全文
posted @ 2014-07-31 22:49 zzyoucan 阅读(794) 评论(0) 推荐(0) 编辑
摘要:#include #include //std::bind返回函数对象void fun1(int a, int b){ std::cout func;//function可以存储函数指针对象,之前以为只能存储std::bind func = fun1; func(5, 6); ... 阅读全文
posted @ 2014-07-31 22:14 zzyoucan 阅读(299) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示