摘要: 今天晚上去旁听了C++高级编程的课,其中提到智能指针。第一反映还以为是auto_ptr呢,一听才知道是share_ptr这个。哦,原来是C++11特性。大致的原因是auto_ptr有一点缺陷,而share_ptr比较安全。好吧,那就这个了。 先写一个简单的代码感受一下 1 #include 2 #include 3 4 using namespace std; 5 using std::tr1::shared_ptr; 6 7 int main() 8 { 9 {10 shared_ptr pp(new double(22.22));11 ... 阅读全文
posted @ 2014-03-14 00:48 无脑仔的小明 阅读(3032) 评论(1) 推荐(0)