摘要: 转自 C++11中智能指针的原理、使用、实现 #include #include template class SmartPointer { private: T* _ptr; size_t* _count; public: SmartPointer(T* ptr = nullptr) : _ptr(ptr) { if (_p... 阅读全文
posted @ 2019-03-06 21:36 青儿哥哥 阅读(1458) 评论(0) 推荐(0) 编辑
摘要: 转自https://www.cnblogs.com/JMLiu/p/7928425.html 一、主要讨论下面两个函数的区别: 上面两个函数,第一个返回值是int的引用int&,第二个返回值是int,二者的区别是什么呢? 我们先用一个语句 const int& a = mymay.at(); 来分别 阅读全文
posted @ 2019-03-06 21:14 青儿哥哥 阅读(11000) 评论(0) 推荐(0) 编辑