Effective Modern C++
文章平均质量分 83
钱塘天梭
这个作者很懒,什么都没留下…
展开
-
Item 40: Use std::atomic for concurrency, volatile for special memory
区分std::atomic和volatile原创 2022-11-22 16:59:50 · 202 阅读 · 0 评论 -
Item 37: Make std::threads unjoinable on all paths
std::thread 对象结束时必须变成 unjoinable(不可联结)状态原创 2022-11-18 17:43:50 · 91 阅读 · 0 评论 -
Item 36: Specify std::launch::async if asynchronicity is essential.
如果异步是必要的,请指定std::launch::async启动策略原创 2022-11-17 17:30:09 · 62 阅读 · 0 评论 -
Item 35:Prefer task-based programming to thread- based.
优先选用基于任务的程序设计原创 2022-11-16 18:07:25 · 196 阅读 · 0 评论 -
CHAPTER 7 The Concurrency API
c++ 11最大的成就之一是将并发性纳入语言和库中。由此产生的语言保证意味着,在c++的历史上,程序员第一次可以在所有平台上以标准行为编写多线程程序。这为构建丰富性的库奠定了坚实的基础,而STL库的并发元素(任务、未来、线程、互斥对象、条件变量、原子对象等等)仅仅是一个开始,它必将成为开发并发c++软件的一套越来越丰富的工具。模板:std::future和std::shared_future。在很多情况下,两者的区别并不重要,所以我经常简单地谈论。在接下来的条款中,请记住标准库有两个。原创 2023-02-10 11:34:28 · 69 阅读 · 0 评论 -
Item 34: Prefer lambdas to std::bind
优先使用lambda表达式,而不是std::bind原创 2022-10-21 18:07:01 · 249 阅读 · 0 评论 -
Item 33: Use decltype on auto&& parameters to std::forward them
Item 33:Use decltype on auto&& parameters to std::forward them原创 2022-10-21 15:16:08 · 154 阅读 · 0 评论 -
Item 32: Use init capture to move objects into closures
使用初始化捕获将对象移入闭包原创 2022-10-21 11:30:54 · 189 阅读 · 0 评论 -
Item 31: Avoid default capture modes
避免默认捕获模式原创 2022-10-19 17:16:11 · 104 阅读 · 0 评论 -
CHAPTER 6 Lambda Expressions
Lambda 表达式原创 2022-10-19 14:06:12 · 87 阅读 · 0 评论 -
Item 26: Avoid overloading on universal references
避免利用万能引用类型进行重载原创 2022-10-18 16:18:20 · 109 阅读 · 0 评论 -
Item 25: Use std::move on rvalue references, std::forward on universal references
对右值引用使用std::move,对万能引用则使用std::forward原创 2022-10-17 16:27:00 · 60 阅读 · 0 评论 -
Item 24: Distinguish universal references from rvalue references
区分万能引用和右值引用原创 2022-10-10 17:22:13 · 285 阅读 · 0 评论 -
Item 23: Understand std::move and std::forward
理解std::move 和 std::forward原创 2022-10-08 16:46:50 · 189 阅读 · 0 评论 -
CHAPTER 5 Rvalue References, Move Semantics, and Perfect Forwarding
右值引用、移动语义和完美转发原创 2022-09-30 16:41:21 · 89 阅读 · 0 评论 -
Item 22: When using the Pimpl Idiom, define special member functions in the implementation file
使用Pimpl机制时,将特殊成员函数的定义放在实现文件中原创 2022-09-29 18:17:22 · 196 阅读 · 0 评论 -
Item 21: Prefer std::make_unique and std::make_shared to direct use of new
std::make_unique std::make_shared new原创 2022-09-16 20:51:36 · 388 阅读 · 0 评论 -
Item 20: Use std::weak_ptr for std::shared_ptr - like pointers that can dangle
使用std::weak_ptr替代可能失效的std::shared_ptr原创 2022-09-15 14:31:26 · 242 阅读 · 0 评论 -
Item 19: Use std::shared_ptr for shared-ownership resource management
使用std::share_ptr管理具有共享所有权的资源原创 2022-09-14 11:00:45 · 322 阅读 · 0 评论 -
Item 18: Use std::unique_ptr for exclusive-ownership resource management
使用srd::unique_ptr来管理独占所有权的资源原创 2022-09-04 18:45:13 · 192 阅读 · 0 评论 -
Item 17: Understand special member function generation
理解特殊成员函数的生成机制原创 2022-09-04 18:43:36 · 277 阅读 · 0 评论 -
Item 15: Use constexpr whenever possible
尽可能的使用constexpr原创 2022-08-25 17:30:10 · 358 阅读 · 0 评论 -
Item 14: Declare functions noexcept if they won’t emit exceptions
只要函数不会抛出异常,就为它加上noexcept声明原创 2022-08-23 17:50:31 · 125 阅读 · 0 评论 -
Item 12: Declare overriding functions override
声明意在重写的函数为override原创 2022-08-22 16:14:32 · 234 阅读 · 0 评论 -
Item 11: Prefer deleted functions to private undefined ones
优先选用delete,而非private原创 2022-08-19 16:41:03 · 620 阅读 · 0 评论 -
Item 10: Prefer scoped enums to unscoped enums
优先选用scoped enum,而非unscoped enum原创 2022-08-18 16:48:26 · 286 阅读 · 0 评论 -
Item 9:Prefer alias declarations to typedefs
优先选用别名声明,而非typedef原创 2022-08-18 16:31:00 · 201 阅读 · 0 评论 -
Item 8: Prefer nullptr to 0 and NULL
优先选用nullptr,而非0或NULL原创 2022-08-17 16:39:35 · 118 阅读 · 0 评论