上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 68 下一页
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 //传递模板进去自动确定模板的元素类型 7 template 8 void showall(vector v,list l) 9 { 10 for (auto i : v) 11 { 12 cout myint{ 1,... 阅读全文
posted @ 2018-03-12 23:14 喵小喵~ 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 using std::function; 5 6 int add(int a, int b) 7 { 8 return a + b; 9 } 10 11 template 12 T run(T t1, T t2, F f) 13 { 14 return f(t... 阅读全文
posted @ 2018-03-12 23:05 喵小喵~ 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 template 5 void show(T t) 6 { 7 cout << t << endl; 8 t += 10; 9 } 10 11 void main() 12 { 13 double db(1.0); 14 double &ldb(db); 15 ... 阅读全文
posted @ 2018-03-12 23:00 喵小喵~ 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 template 5 class myclass 6 { 7 public: 8 T t; 9 void show(T tx) 10 { 11 cout t1; 29 30 //检测某个模板有没有根据某个类型实例化 31 __if_exis... 阅读全文
posted @ 2018-03-12 22:20 喵小喵~ 阅读(469) 评论(0) 推荐(0) 编辑
摘要: 初始化单向链表 1 forward_list<int> list1{ 1,2,3,4,5 }; 链表排序 1 list1.sort();//排序 前插 1 list1.push_front(10); 链表反转 1 list1.reverse(); 链表头结点 1 auto ib = list1.be 阅读全文
posted @ 2018-03-12 21:13 喵小喵~ 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 5 //显示{}中的数据 6 void show(initializer_list list) 7 { 8 for (auto i : list) 9 { 10 cout list) 16 { 17 int length = list.s... 阅读全文
posted @ 2018-03-12 20:07 喵小喵~ 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 声明+delete:函数禁止使用.可以使一个类禁止释放 阅读全文
posted @ 2018-03-12 19:58 喵小喵~ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 数据类型转换(static_cast) //数据类型转换 printf("%d\n", static_cast<int>(10.2)); 指针类型转换(reinterpret_cast) 1 指针类型转换 2 int *pint = new int(1); 3 char *pch = reinter 阅读全文
posted @ 2018-03-12 19:55 喵小喵~ 阅读(6850) 评论(0) 推荐(0) 编辑
摘要: 要想解决死锁就需要lock与unlock成对使用,不允许连续使用两个lock 阅读全文
posted @ 2018-03-12 17:12 喵小喵~ 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 //通过mutex 等待事件响应 10 condition_variable isfull, isempty;//处理两种情况 11 mutex m; 12 bool flag =... 阅读全文
posted @ 2018-03-12 16:47 喵小喵~ 阅读(119) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 68 下一页