Effective Modern C++

Scott Meyers

出版时间

2015-08-31

ISBN

9787564159115

评分

★★★★★

标签

编程

书籍介绍
这并非一本教你C++11新语法的入门书,而是给已掌握C++、却在新标准下屡屡踩坑的开发者准备的「避坑手册」。作者Scott Meyers没有泛泛而谈「现代C++有什么好处」,而是聚焦那些看似简单、实则暗藏陷阱的细节:花括号与圆括号初始化的微妙差异、std::move何时会帮倒忙、完美转发如何被意外截断。读者最看重的,是它把「为什么该这么做」讲透,而非罗列「该怎么做」的教条。条目之间相对独立、含金量分布均匀,避免了技术书常见的「狗尾」式注水,适合随时查阅。它适合那些写过C++98、正努力将旧代码迁移到现代标准、并渴望理解背后原理而非死记规则的工程师。
AI导读
核心看点
  • 深入解析C++11/14的42个具体做法
  • 涵盖类型推导、移动语义、Lambda等核心特性
  • 指导如何将旧代码迁移至现代C++规范
读者共识
  • 内容精深,是学习现代C++的必读经典之作
  • 条款独立性强,无传统技术书末尾注水现象
  • 部分章节顺序突兀,新手阅读门槛较高
精彩摘录
  • "......create softerware that's correct efficient maintainable portable"
  • "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."
  • "When users of a complex system are ignorant of how it works, yet happy with what it does, that says a lot about the design of the system. By this measure, template type deduction in C++ is a tremendous success."
  • "The ability to declare references to arrays enables creation of a template that deduces the number of elements that an array contains."
  • "The only real difference between auto and template type deduction is that auto assumes that a braced initializer represents a std::initializer_list, but the template type deduction doesn't."
  • "In C++11, perhaps the primary use for decltype is declaring function templates where the function's return type depends on its parameter types."
  • "The use of "decltype(auto)" is not limited to function return type. I can also be convenient for declaring variables when you want to apply the decltype type deduction rules to the initializing expression."
  • "Employing pass-by-value for objects of an unknown type generally risks the performance hit of unnecessary copying, the behavioral problems of object slicing, and ..."
目录
From the Publisher
Acknowledgments
Introduction
1.Deduang Types
Item 1: Understand template type deduction.

显示全部
用户评论
理清了C++11以及C++14的一些特性,值得反复阅读
C++这傻逼语言赶紧死吧,光把语言细节搞清楚都费太多时间了。
影印版,内容精深,纸质很赞。
印刷太差,出版社太贪
一些地方感觉有些教条主义了,比较适合多次阅读
不愧是经典,中文翻译:https://github.com/kelthuzadx/EffectiveModernCppChinese
文风比十好几年前基于C++ 98/03标准的Effective系列风趣了好多。质量一如继往的上乘。另外这种逐条陈述的书各个条目之间相对独立,不会有一般技术书那种到最后几章干货和有用信息越来越稀的效应(我把它叫做“狗尾”效应)。
下载
收藏