探索C++17精华:新标准的激动人心特性详解

需积分: 29 37 下载量 155 浏览量 更新于2024-07-16 收藏 1.37MB PDF 举报
"C++17 in Detail" 是由 Bartłomiej Filipek 编著的一本详细指南,专注于介绍C++17的新特性和改进。自C++11以来,C++语言经历了显著的进步,C++11引入了lambda表达式、constexpr、变量模板、并行编程特性如线程和范围for循环,以及智能指针等现代特性。C++14虽然相对较小,但对标准进行了优化和扩展。 该书在2019年11月13日发布,通过Leanpub平台发行,这是一套轻量级工具,作者能够实时获取读者反馈,并根据反馈进行迭代,以确保最终产品满足读者需求。书中版权信息表明,该书是在2018年至2019年间创作的,面向所有希望深入了解C++17新特性的读者。 "快速入门"章节帮助读者迅速上手C++17,而"已移除或修复的语言特性"部分着重讨论了这一版本中删除的旧特性与对原有问题的修正。例如,书中详细探讨了移除的一些元素和针对编译器支持的改进。此外,C++17在表达式评估顺序、内存管理(特别是对齐数据的动态内存分配)和异常处理方面的规范也得到了明确和强化。 "语言澄清"部分则深入解析了C++17对语言规则的进一步阐明,确保代码的可预测性和一致性。例如,书中可能解释了如何确保在特定情况下执行严格的表达式求值顺序,以及对拷贝构造和析构的保证删除优化。 "前言"和"关于本书"介绍了作者Bartłomiej Filipek的背景以及编写此书的目的,以及针对读者群体(如初学者和经验丰富的开发者)的定位。总体结构方面,书籍按照逻辑顺序组织,包括读者反馈和示例代码,旨在提供一个全面且实用的学习路径。 "第一部分:语言特性"涵盖了本书的核心内容,详细讲解了C++17中的各种新功能和改进,帮助读者逐步掌握这些激动人心的C++语言升级。无论是初次接触C++17还是寻求进阶知识的读者,都能从中受益匪浅。通过阅读这本书,读者不仅能够学习到语言的最新进展,还能提升编程技能和理解现代C++的最佳实践。
2020-01-26 上传
If you’ve ever asked “what’s in C++17 and what does it mean for me and my code?” — and I hope you have — then this book is for you. Now that the C++ standard is being released regularly every three years, one of the challenges we have as a community is learning and absorbing the new features that are being regularly added to the standard language and library. That means not only knowing what those features are, but also how to use them effectively to solve problems. Bartlomiej Filipek does a great job of this by not just listing the features, but explaining each of them with examples, including a whole Part 3 of the book about how to apply key new C++17 features to modernize and improve existing code — everything from upgrading enable_if to the new if constexpr, to refactoring code by applying the new optional and variant vocabulary types, to writing parallel code using the new standard parallel algorithms. In each case, the result is cleaner code that’s often also significantly faster too. The point of new features isn’t just to know about them for their own sake, but to know about how they can let us express our intent more clearly and directly than ever in our C++ code. That ability to directly “say what we mean” to express our intent, or to express “what” we want to achieve rather than sometimes-tortuous details of “how” to achieve it through indirect mechanisms, is the primary thing that determines how clean and writable and readable — and correct — our code will be. For C++ programmers working on real-world projects using reasonably up-to-date C++ compilers, C++17 is where it’s at in the industry today for writing robust production code. Knowing what’s in C++17 and how to use it well is an important tool that will elevate your day-to-day coding, and more likely than not reduce your day-to-day maintenance and debugging chores. If you’re one of the many who have enjoyed Barteks’s blog (bfilipek.com, frequently cited at isocpp.org), you’ll certainly also enjoy this entertaining and informative book. And if you haven’t enjoyed his blog yet, you should check it out too… and then enjoy the book.
2019-08-18 上传
Welcome to Beginning C++17. This is a revised and updated version of Ivor Horton’s original book called Beginning ANSI C++. The C++ language has been extended and improved considerably since then, so much so that it was no longer possible to squeeze detailed explanations of all of C++ into a single book. This tutorial will teach the essentials of the C++ language and Standard Library features, which will be more than enough for you to write your own C++ applications. With the knowledge from this book, you should have no difficulty in extending the depth and scope of your C++ expertise. We have assumed no prior programming knowledge. If you are keen to learn and have an aptitude for thinking logically, getting a grip on C++ will be easier than you might imagine. By developing C++ skills, you’ll be learning a language that is already used by millions and that provides the capability for application development in just about any context. C++ is very powerful. Arguably, it’s more powerful than most programming languages. So, yes, like with any powerful tool you can wield some considerable damage if you use it without proper training. We often compare C++ to a Swiss Army knife: age-old, trusted, incredibly versatile, yet potentially mind-boggling and full of pointy things that could really hurt you. Once someone clearly explains to you what all the different tools are meant for, however, and teaches you some elementary knife safety rules, then you’ll never have to look for another pocketknife again. C++ does not need to be dangerous or difficult at all either. C++ today is much more accessible than many people assume. The language has come a long way since its conception nearly 40 years ago. In essence, we have learned how to wield all its mighty blades and tools in the safest and most effective way possible. And, more importantly perhaps, the C++ language and its Standard Library have evolved accordingly to facilitate this. The past decade in particular has seen the ris