自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 收藏
  • 关注

原创 Item 30:Familiarize yourself with perfect forwarding failure cases

Item 30:Familiarize yourself with perfect forwarding failure cases情况1:情况2:情况3:完美转发不仅仅是转发对象,而且还转发对象的修饰,无论是左值右值还是const或者volatile。但是完美转发也有失效的时候。情况1:template<typename T>void fwd(T&& para...

2019-04-02 09:11:43 131

原创 Item 29:Assume that move operations are not present, not cheap, and not used.

Item 29:Assume that move operations are not present, not cheap, and not used.Move 并不是万能的,在一些特定的情况下使用move 关键字,实际上并没有使用所期待的操作,或者并没有想象中的节省。例如stl 库中,当使用 std::vector 的时候,move的花费就很低,因为这种容器会有一个唯一的指针指向它,mov...

2019-03-18 04:41:43 125

原创 Item 28: Understand reference collapsing.

Item 28: Understand reference collapsing.引用折叠。不同的引用是不能同时使用的。例如: Widget&amp; &amp;&amp; w 是非法的。但是在特定情况下,引用是可以折叠的。首先一个知识点:在使用模板函数的时候 template&lt;typename T&gt; void func(T&amp;&amp; param)C++的编码...

2019-03-13 09:08:33 127

原创 Item 27: Familiarize yourself with alternatives to overloading on universal references

Item 27: Familiarize yourself with alternatives to overloading on universal references (Effective Modern C++ 读书笔记)这一章主要解决Item 26的问题。解决方法,使用信号调度(Use flag dispatch)先来解决如下例子:std::multiset&amp;lt;std::str...

2019-03-10 10:35:18 170

原创 Item 26: Avoid overloading on universal reference (Effective Modern C++ 读书笔记)

Item 26: Avoid overloading on universal reference之前看书看到了25,决定写读书笔记,所以从26开始,全书完本后回补之前的。写笔记感觉比只看书效果好很多,虽然用了更多时间,但是确实非常有收获。开始正题。上例子:std::multiset&amp;amp;lt;std::string&amp;amp;gt; names;void logAndAdd(const std::s...

2019-03-08 23:28:47 169 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除