摘要: shared_ptr 不能这样用 int *p1=new int; std::shared_ptr<int> p2 (p1); std::shared_ptr<int> p3 (p1); 问题在于引用计数混乱,不是同一个 sharing group ,指向同一个对象 可以这样用 std::share 阅读全文
posted @ 2019-08-19 10:59 Asele 阅读(554) 评论(0) 推荐(0)
摘要: //为防止static变量被多次declaration int Dummy::n=0;放于类外 #include <iostream>using namespace std; class Dummy { public: static int n; Dummy () { n++; };}; int D 阅读全文
posted @ 2019-08-12 17:34 Asele 阅读(91) 评论(0) 推荐(0)
摘要: 详细的安装步骤看这里 https://blog.csdn.net/zhys0902/article/details/79499329 jdk-12.0.2_windows-x64_bin的下载 https://pan.baidu.com/s/1XG8owNLkzMcu1drijKWb8g 提取码 k 阅读全文
posted @ 2019-08-12 14:06 Asele 阅读(160) 评论(0) 推荐(0)
摘要: // class templates #include <iostream> using namespace std; template <class T> class mypair { T a, b; public: mypair (T first, T second) {a=first; b=s 阅读全文
posted @ 2019-08-12 11:23 Asele 阅读(173) 评论(0) 推荐(0)