![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
文章平均质量分 52
ffiirree
学生
展开
-
右值、移动语义和完美转发
1. lvalue / rvalue An lvalue is an expression that refers to a memory location and allows us to take the address of that memory location via the & operator. An rvalue is an expression that is ...原创 2018-04-25 18:22:48 · 380 阅读 · 0 评论 -
引用计数与智能指针
C++没有完善的GC机制,直到C++11才在STL中正式引入了智能指针。出现在库中说明智能指针不是语言特性。C++智能指针实现了部分自动内存管理的目的。引用计数引用计数是使用资源管理函数(构造析构复制等函数)和作用域原理实现的。每块动态分配的内存(堆内存)都维护一个相应的计数器,来记录指向该内存的变量数目,当值为0时,意味着没有变量再使用该部分内存,意味着可以删除掉。引用计数的优缺点引用计...原创 2019-03-01 15:31:10 · 366 阅读 · 0 评论 -
模板类型推断、auto和decltype
template type deductionreference or pointerint x = 27; const int cx = x;const int& rx = x; template<typename T>void f(T& param); int : int&const int : const int&cons...原创 2019-05-17 10:43:56 · 439 阅读 · 0 评论 -
从C++对象模型谈C语言的继承与多态
C++类中一般包含两种数据成员和三中函数成员。原创 2019-02-28 16:57:07 · 346 阅读 · 0 评论