《Effective Modern C++:改善C++11和C++14的42个具体做法(影印版)(英文版)》中包括以下主题:剖析花括号初始化、noexcept规范、完美转发、智能指针make函数的优缺点;讲解std∷move,std∷forward,rvalue引用和全局引用之间的关联;介绍编写清晰、正确、高效lambda表达式代码的技巧;辨析std∷atomic和volatile之间的差异,它们各自该如何使用,还有它们与C++并行计算API之间的关联;如何修改老C++编程(比如C++98)中的实践,使之符合现代C++的软件开发规范。
Scott Meyers is one of the world's foremost authorities on C++. He wrote the best-selling Effective C++ series (Effective C++, More Effective C++, and Effective STL); published and maintains the annotated training materials Overview of the New C++ (C++11/14) and Effective C++ in an Embedded Environment; is Consulting Editor for the Effective Software Development Series, and, wi...
Scott Meyers is one of the world's foremost authorities on C++. He wrote the best-selling Effective C++ series (Effective C++, More Effective C++, and Effective STL); published and maintains the annotated training materials Overview of the New C++ (C++11/14) and Effective C++ in an Embedded Environment; is Consulting Editor for the Effective Software Development Series, and, with Herb Sutter and Andrei Alexandrescu, is a principal in C++ and Beyond. He has a Ph.D in Computer Science from Brown University. He's currently working on a new book, Effective Modern C++, which he expects to publish this fall.
目录
· · · · · ·
From the Publisher
Acknowledgments
Introduction
1.Deduang Types
Item 1: Understand template type deduction.
Item 2: Understand auto type deduction.
· · · · · ·
(更多)
From the Publisher
Acknowledgments
Introduction
1.Deduang Types
Item 1: Understand template type deduction.
Item 2: Understand auto type deduction.
Item 3: Understand decltype.
Item 4: Know how to view deduced types.
2.auto
Item 5: Prefer auto to explicit type declarations.
Item 6: Use the explicitly typed initializer idiom when auto deduces undesired types.
3.Moving to Modern C++
Item 7: Distinguish between()and {} when creating objects.
Item 8: Prefer nullptr to 0 and NULL.
Item 9: Prefer alias declarations to typedefs.
Item 10: Prefer scoped enums to unscoped enums.
Item 11: Prefer deleted functions to private undefined ones.
Item 12: Declare overriding functions override.
Item 13: Prefer const_iterators to iterators.
Item 14: Declare functions noexcept ifthey won't emit exceptions.
Item 15: Use constexpr whenever possible.
Item 16: Make const member functions thread safe.
Item 17: Understand special member function generation.
4.Smart Pointers
Item 18: Use std ∷unique_ptr for exclusive—ownership resource management.
Item 19: Use std ∷ shared_ptr for shared—ownership resource management.
Item 20: Use std ∷weak_ptr for std ∷ shared_ptr—like pointers that can dangle.
Item 21: Prefer std∷make_unique and std∷make_shared to direct use of new.
Item 22: When using the Pimplldiom,define speaal member functions in the implementation file.
5.Rvalue References,Move Semantics,and Perfect Forwarding
Item 23: Understand std∷move and std∷forward.
Item 24: Distinguish universal references from rvalue references.
Item 25: Use std∷move on rvalue references,std∷forwa rd on universal references.
Item 26: Avoid overloading on universal references.
Item 27: Familiarize yourselfwith alternatives to overloading on universal references.
Item 28: Understand reference collapsing.
Item 29: Assume that move operations are not present,not cheap,and not used.
Item 30: Familiarize yourselfwith perfect forwarding failure cases.
6.Lambda Expressions
Item 31: Avoid default capture modes.
Item 32: Use init capture to move objects into closures.
Item 33: Use decltype on auto&& parameters to std∷forwa rd them.
Item 34: Prefer lambdas to std∷bind.
7.The Concurrency API
Item 35: Prefer task—based programming to thread—based.
Item 36: Specify std∷launch∷async if asynchronicity is essential.
Item 37: Make std: :threads unjoinable on all paths.
Item 38: Be aware ofvarying thread handle destructor behavior.
Item 39: Consider void futures for one—shot event communication.
Item 40: Use std∷atomic for concurrency,volatile for special memory.
8.Tweaks
Item 41: Consider pass by value for copyable parameters that are cheap to move and always copied.
Item 42: Consider emplacement instead of insertion.
Index
· · · · · · (收起)
C++98 had a single set of rules for type deduction: the one for function templates.
C++11 modifies that ruleset a bit and add two more, one for auto and one for decltype.
C++14 then extends the usage contexts in which auto and decltype may be employed. (查看原文)
建议去读英文原版书籍,这翻译忒差劲了,全程不说人话,能不能找个好点的译者来翻译啊.. 原文: You might as well know about function-to-pointer decay, too 中文版: 指针能翻译成针对 我也是服了 连基本术语都翻得不准确,建议干脆不要翻。
(展开)
4 有用 ItTrivial 2020-11-28 16:35:53
理清了C++11以及C++14的一些特性,值得反复阅读
2 有用 小马过河 2018-05-28 01:00:49
影印版,内容精深,纸质很赞。
0 有用 H.A. 2021-05-22 20:56:45
印刷太差,出版社太贪
0 有用 Ragnarok 2018-05-10 13:01:41
一些地方感觉有些教条主义了,比较适合多次阅读
0 有用 小杨同学 2024-11-09 08:12:23 湖北
必读,收货满满。大部分条款已记录,可见我是多少爱这本书,比之前侯捷翻译的几本更让人兴奋,希望以后这个系列多出书