Skip to Content
C++20 for Programmers: An Objects-Natural Approach, 3rd Edition
book

C++20 for Programmers: An Objects-Natural Approach, 3rd Edition

by Paul Deitel, Harvey Deitel
April 2022
Intermediate to advanced
1012 pages
38h 1m
English
Pearson
Content preview from C++20 for Programmers: An Objects-Natural Approach, 3rd Edition

18. C++20 Coroutines

Objectives

In this chapter, you’ll:

  • Understand what coroutines are and how they’re used.

  • Use keyword co_yield to suspend a generator coroutine and return a result.

  • Use the co_await operator to suspend a coroutine while it waits for a result to become available.

  • Use a co_return statement to terminate a coroutine and return its result, or simply control, to its caller.

  • Use the open-source generator library to simplify creating a generator coroutine with co_yield.

  • Use the open-source concurrencpp library to simplify creating coroutines with co_await and co_return.

  • Become aware of coroutine capabilities being contemplated for future C++ versions.

Outline

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Designing Data-Intensive Applications, 2nd Edition

Designing Data-Intensive Applications, 2nd Edition

Martin Kleppmann, Chris Riccomini

Publisher Resources

ISBN: 9780136905776