-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
删除 Gitbook 无意义配置文件,增加课程链接,增加部分协程前言描述(还需修改,无太多价值)
- Loading branch information
Showing
3 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
# 协程 | ||
|
||
## 前言 | ||
|
||
既然是“**现代**” C++ 并发编程教程,怎么能不聊协程呢? | ||
|
||
C++20 引入了协程语法,新增了三个用作协程的关键字:`co_await`、`co_yield`、`co_return`。但并未给出标准**协程库**,协程库在 C++23 被引入。 | ||
|
||
希望您拥有 `gcc14`、`clang18`,最新的 MSVC。 | ||
希望您拥有 `gcc14`、`clang19`,`Visual Studio 2022 17.11`。 | ||
|
||
我们假设您对 C++20 的协程一无所知、假设您对协程这个概念一无所知、假设您不了解其它语言的协程实现(如 Python、java)。 | ||
|
||
--- | ||
|
||
绝大多数人对协程基本可以说是一无所知,但是应该都听过这个名字,大概是因为这些编程语言都在新版本中引入它作为核心语言特性。 | ||
|
||
这带来了许多的热度,不过这并不完全算是好事,许多的营销号一样的讲述,基本全部都是错误的。 | ||
|
||
据我所知,在我在 B站发布正经 C++20 协程的教学视频之前,几乎所有打着 C++ 旗号说什么协程的,都是胡言乱语。不过也有一些不错的,如:[**等疾风**](https://space.bilibili.com/35186937)、[**happyyang的百草园**](https://space.bilibili.com/312883756),都出过至少算作正经的 C++20 协程的教学视频。 | ||
|
||
- **C++20 的协程是复杂的**。 | ||
|
||
> C++ 20 协程的使用尚不成熟,等待后续更新讲解..... | ||
不管是使用上还是概念上,引入了许多新颖的做法。 |