update: prepare C++20

This commit is contained in:
Changkun Ou
2019-07-08 13:17:58 +02:00
parent 7204a23882
commit 407148cfff
28 changed files with 66 additions and 67 deletions

0
book/en-us/00-preface.md Normal file
View File

View File

@@ -1,9 +1,9 @@
# C++ 11/14/17 On The Fly
# C++ 11/14/17/20 On The Fly
## Table of Contents
- [**Preface**](./00-preface.md)
- [**Chapter 01 Towards C++11/14/17**](./01-intro.md)
- [**Chapter 01 Towards Modern C++**](./01-intro.md)
+ 1.1 Deprecated Features
+ 1.2 Compatibility with C
+ Further Readings
@@ -39,69 +39,71 @@
- Explicit delete default function
- Strongly typed enumerations
- [**Chapter 03 Language Runtime Enhancements**](./03-runtime.md)
+ Lambda expression
+ 3.1 Lambda expression
+ Basics
+ Value capture
+ Reference capture
+ Implicit capture
+ Expression capture
+ Generic lambda
+ Function object wrapper
+ 3.2 Function object wrapper
+ std::function
+ std::bind/std::placeholder
+ rvalue reference
+ 3.3 rvalue reference
+ lvalue, rvalue, prvalue, xvalue
+ rvalue reference & lvalue reference
+ Move semantics
+ Perfect forwarding
- [**Chapter 04 Sandard Library: Containers**](./04-containers.md)
+ `std::array`
+ `std::forward_list`
+ `std::unordered_set`
+ `std::unordered_map`
+ `std::tuple`
+ 4.1 `std::array` and `std::forward_list`
+ 4.2 Unordered containers
+ `std::unordered_set`
+ `std::unordered_map`
+ 4.3 Tuples `std::tuple`
+ basic operation
+ runtime indexing
+ merge and iteration
- [**Chapter 05 Sandard Library: Pointers**](./05-pointers.md)
+ RAII and reference counting
+ `std::shared_ptr`
+ `std::unique_ptr`
+ `std::weak_ptr`
+ 5.1 RAII and reference counting
+ 5.2 `std::shared_ptr`
+ 5.3 `std::unique_ptr`
- [**Chapter 06 Sandard Library: Regular Expression**](./06-regex.md)
+ Regular Expression Introduction
+ 6.1 Regular Expression Introduction
+ Normal characters
+ Special characters
+ Determinative
+ `std::regex`
+ 6.2 `std::regex` and related
+ `std::regex`
+ `std::regex_match`
+ `std::match_results`
- [**Chapter 07 Sandard Library: Threads and Concurrency**](./07-thread.md)
+ `std::thread`
+ `std::mutex`
+ `std::unique_lock`
+ `std::future`
+ `std::packaged_task`
+ `std::condition_variable`
+ 7.1 `std::thread`
+ 7.2 `std::mutex` and `std::unique_lock`
+ 7.3 `std::future` and `std::packaged_task`
+ 7.4 `std::condition_variable`
+ 7.5 `std::atomic` and memory order
+ 7.6 Transactional memory
- [**Chapter 08 Sandard Library: File System**](./08-filesystem.md)
+ 8.1 Documents and links
+ 8.2 `std::filesystem`
- [**Chapter 09 Minor Features**](./09-others.md)
+ New Types
+ 9.1 New Types
+ `long long int`
+ `noexcept`
+ Literal
+ 9.2 `noexcept` and its operates
+ 9.3 Literal
+ Raw string literal
+ Custom string literal
+ Math Library
+ 9.4 Math Library
- [**Chapter 10 Outlook: Introduction of C++20**](./10-cpp20.md)
+ Concept
+ Range
+ Module
+ Coroutine
- [**Appendix: Further Study Materials**](./appendix.md)
- [**Appendix 1: Further Study Materials**](./appendix1.md)
- [**Appendix 2: Modern C++ Best Practices**](./appendix2.md)
Table of Content | Last Chapter | [Next Chapter: Preface](./00-preface.md)
## Licenses
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work is written by [Ou Changkun](https://changkun.de) and licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>. The code of this repository is open sourced under the [MIT license](./LICENSE).
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work was written by [Ou Changkun](https://changkun.de) and licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>. The code of this repository is open sourced under the [MIT license](./LICENSE).

View File

@@ -9,9 +9,9 @@ order: 0
## 引言
C++ 是一个用户群体相当大的语言。从 C++98 的出现到 C++11 的正式定稿经历了长达十年多之久的积累。C++14/17 则是作为对 C++11 的重要补充和优化,所有这些新标准中扩充的特性,给 C++ 这门语言注入了新的活力。
那些还在坚持使用**传统 C++**(本书把 C++98 及其之前的 C++ 特性均称之为传统 C++)而未接触过 C++11/14/17 的 C++ 程序员在见到诸如 Lambda 表达式这类全新特性时,甚至会流露出『学的不是同一门语言』的惊叹之情。
那些还在坚持使用**传统 C++**(本书把 C++98 及其之前的 C++ 特性均称之为传统 C++)而未接触过 C++11/14/17/20 的 C++ 程序员在见到诸如 Lambda 表达式这类全新特性时,甚至会流露出『学的不是同一门语言』的惊叹之情。
**C++1x** (或**现代 C++**,本书中均指 C++11/14/17) 为传统 C++ 注入的大量特性使得整个 C++ 变得更加像一门现代化的语言。C++1x 不仅仅增强了 C++ 语言自身的可用性,`auto` 关键字语义的修改使得我们更加有信心来操控极度复杂的模板类型。同时还对语言运行期进行了大量的强化Lambda 表达式的出现让 C++ 具有了『匿名函数』的『闭包』特性,而这一特性几乎在现代的编程语言(诸如 Python/Swift/... )中已经司空见惯,右值引用的出现解决了 C++ 长期以来被人诟病的临时对象效率问题等等。
**C++1x** (或**现代 C++**,本书中均指 C++11/14/17/20) 为传统 C++ 注入的大量特性使得整个 C++ 变得更加像一门现代化的语言。C++1x 不仅仅增强了 C++ 语言自身的可用性,`auto` 关键字语义的修改使得我们更加有信心来操控极度复杂的模板类型。同时还对语言运行期进行了大量的强化Lambda 表达式的出现让 C++ 具有了『匿名函数』的『闭包』特性,而这一特性几乎在现代的编程语言(诸如 Python/Swift/... )中已经司空见惯,右值引用的出现解决了 C++ 长期以来被人诟病的临时对象效率问题等等。
C++17 则是近三年依赖 C++ 社区一致推进的方向,也指出了**现代C++**编程的一个重要发展方向。尽管它的出现并不如 C++11 的分量之重,但它包含了大量小而美的语言与特性(例如结构化绑定),这些特性的出现再一次修正了我们在 C++ 中的编程范式。
@@ -36,7 +36,7 @@ C++17 则是近三年依赖 C++ 社区一致推进的方向,也指出了**现
本书每章中都出现了大量的代码,如果你在跟随本书介绍特性的思路编写自己的代码遇到问题时,不妨读一读随书附上的源码,你可以在[这里](../code)中找到书中介绍过的全部的源码,所有代码按章节组织,文件夹名称为章节序号。
[返回目录](./toc.md) | 上一章 | [下一章 迈向 C++11/14/17](./01-intro.md)
[返回目录](./toc.md) | 上一章 | [下一章 迈向现代 C++](./01-intro.md)
## 许可

View File

@@ -1,10 +1,10 @@
---
title: 第 1 章 迈向 C++11/14/17
title: 第 1 章 迈向现代 C++
type: book-zh-cn
order: 1
---
# 第 1 章 迈向 C++11/14/17
# 第 1 章 迈向现代 C++
[TOC]

View File

@@ -931,7 +931,7 @@ std::cout << new_enum::value3 << std::endl
## 总结
本节介绍了 C++11/14/17 中对语言可用性的增强,其中笔者认为最为重要的几个特性是几乎所有人都需要了解并熟练使用的:
本节介绍了 C++11/14/17/20 中对语言可用性的增强,其中笔者认为最为重要的几个特性是几乎所有人都需要了解并熟练使用的:
1. auto 类型推导
2. 范围 for 迭代

View File

@@ -130,7 +130,7 @@ Concepts TS 的发布到最后一次 C++17 的讨论会只相隔了不到四个
1. [Final features of C++17](https://meetingcpp.com/index.php/br/items/final-features-of-c17.html)
2. [C++17: will it be great or just ok?](https://codeplay.com/public/uploaded/filehost/0cbdaf_c++17post-oulu2016.pdf)
3. [Why Concepts didn't make C++17](http://honermann.net/blog/2016/03/06/why-concepts-didnt-make-cxx17/)
4. [C++11/14/17 编译器支持情况](http://en.cppreference.com/w/cpp/compiler_support)
4. [C++11/14/17/20 编译器支持情况](http://en.cppreference.com/w/cpp/compiler_support)
## 许可

View File

@@ -8,7 +8,7 @@ order: 11
首先,恭喜你阅读完本书 🎉 !笔者希望本书有提起你对现代 C++ 的兴趣。
正如本书引言部分提到的,本书只是一本带你快速领略现代 C++ 11/14/17 新特性的读物,而非进阶学习实践 C++『黑魔法』的内容。笔者当然也想到了这个需求,只是这样的内容非常艰深,鲜有受众。在此,笔者列出一些能够帮助你在此书基础之上进一步学习现代 C++ 的资料,希望能够祝你一臂之力:
正如本书引言部分提到的,本书只是一本带你快速领略现代 C++ 11/14/17/20 新特性的读物,而非进阶学习实践 C++『黑魔法』的内容。笔者当然也想到了这个需求,只是这样的内容非常艰深,鲜有受众。在此,笔者列出一些能够帮助你在此书基础之上进一步学习现代 C++ 的资料,希望能够祝你一臂之力:
- [C++ 参考](http://en.cppreference.com/w)
- [CppCon YouTube 频道](https://www.youtube.com/user/CppCon/videos)

View File

@@ -1,11 +1,9 @@
# 高速上手 C++ 11/14/17
> 正在向全面介绍 C++17 特性的内容过度
# 高速上手 C++ 11/14/17/20
## 目录
- [**序言**](./00-preface.md)
- [**第 1 章 迈向 C++11/14/17**](./01-intro.md)
- [**第 1 章 迈向现代 C++**](./01-intro.md)
+ 1.1 被弃用的特性
+ 1.2 与 C 的兼容性
+ 进一步阅读的参考文献
@@ -83,6 +81,8 @@
+ 7.2 `std::mutex``std::unique_lock`
+ 7.3 `std::future``std::packaged_task`
+ 7.4 `std::condition_variable`
+ 7.5 `std::atomic` 与内存顺序
+ 7.6 事务内存
- [**第 8 章 标准库: 文件系统**](./08-filesystem.md)
+ 8.1 文档与链接
+ 8.2 `std::filesystem`