We may earn an affiliate commission when you visit our partners.
Umar Lone
  • Update [12-Dec-2024] Added content on new C++20 library features & classes

  • Update [07-Dec-2024] Added concurrency support videos

  • Update [26-Nov-2024] Added quiz for all sections

  • Update [09-Nov-2024] Added more videos with examples of views in Ranges section

Read more
  • Update [12-Dec-2024] Added content on new C++20 library features & classes

  • Update [07-Dec-2024] Added concurrency support videos

  • Update [26-Nov-2024] Added quiz for all sections

  • Update [09-Nov-2024] Added more videos with examples of views in Ranges section

This course only focuses on the new C++20 standard features without going into the basics or details of previous standards of C++ or basics of object-oriented programming.  You must've some basic understanding of C++11 in order to follow through in this course. In case, you're not familiar with modern C++ features, check out my other course called Complete Modern C++.

This course will aim to explain the new core language & the library features. You'll learn to use designated initializers, consteval, consinit, unevaluated constext usage of lambda expressions, enum usage, etc. You'll also get to know about the new way through which C++ code is reused without using header files. This is possible through modules, which is a faster and easier way to reuse existing functions or classes.

If you implement classes for use with containers, then you'll have to provide implementation of many comparison operators which becomes tedious and error prone. C++20 provides a new operator called the three-way comparison operator (space-ship operator) that simplifies implementation of comparison operators. Additionally, it now becomes easier to use algorithms with containers through ranges. No need to use begin() & end() functions to operate on the container.

Concepts is a new way of applying constraints on template arguments. It is much simpler to use as compared to SFINAE (enable_if).  Learn & implement concepts to ensure your functions accept the right kind of arguments and avoid runtime errors.

You'll learn about resumable functions, called coroutines. Using coroutines, you can write concurrent code without the need for synchronization or multiple threads. This enables you to write high performance code without the overhead of creating & destroying threads.

If you're ready, then let's get started right away.

Enroll now

What's inside

Learning objectives

  • Learn about the new c++20 language standard features
  • Migrate existing c++ codebase to c++20
  • Use coroutines to write concurrent code
  • Use modules instead of headers to modularize software
  • Use ranges library to simplify working with containers & algorithms
  • Use concepts to apply constraints on algorithms & classes

Syllabus

More examples of designated initializers. Comparison & differences with C designated initializers.

Quick overview of C++20 features
Read more

Course introduction

Compiler support
A word on source code

Course slides

Understand and apply the core language changes and additions in C++20
Source Code

Introduction to aggregate initialization introduced in C++17.

Designated initialization examples.

Internals of the range for loop and its working.

Issues due to looping over a temporary range.

Introduction to the new char8_t type for UTF-8 characters.

Usage of char8_t type for UTF-8 characters.

Limitations of structured bindings before C++20 and how C++20 overcomes those limitations.

New changes to constexpr keyword.

Concept of an immediate function that is executed at compile-time.

Compiled-time Initialization - constinit

Overview of explicit specifier and the issues we face with some library classes.

Making a constructor conditionally explicit through SFINAE (std::enable_if).

The new conditional explicit specifier and how it can make a constructor explicit based on a compile-time condition.

Quiz for this section

Lambda Expressions & Templates

Deprecation of the implicit capture of this in a lambda expression.

Understand the meaning of evaluated & unevaluated context and how that is relevant to lambda expressions.

C++20 adds the ability to use non-type template parameters as a template argument now, including floating-point types. However, this class must have a constexpr constructor. Learn more about this feature in this lecture.

Understand the limitations of using generic lambdas.

C++20 introduced "template type parameters' for lambda expressions. Learn how they solve certain issues with lambdas and simplify code.

More Core Language Changes

Source code for this section

Attributes - I
Attributes - II
enums
Quiz for sections Lambda Expressions & More Language Changes

Quiz for Lambda Expressions & More Language Features

Text Formatting Library

Introduction to C++98 style formatting using manipulators

More examples of formatting using manipulators

Introduction to the C++20 formatting library

Basic usage of std::format function.

Implementation of the println helper function to avoid repetitive usage of cout and endl.

Note: The newline implementation in this function is missing in this lecture but has been fixed in subsequent lectures.

Explanation of the format specification type.

Explanation of the format specification for fill, alignment & width.

Explanation of the format specification for number formatting.

Explanation of the format specification locale that is used for internationalizing your applications.

Quiz for this section.

Use concepts to constrain the type of arguments that a function or class can work with
Constraining Template Arguments
Concepts Introduction
Concepts Implementation
Concepts Usage Types
Abbreviated Templates
Requirement Types - I
Requirement Types - II
Combining Requirements
More Examples
Quiz
Use modules instead of headers for modularizing a C++ application

Source code.

C++ Build Process Overview
Introduction to Modules
Modules Example
Module Naming
Modules Build Process
Declaration & Definition Separation
Submodules
Partition Modules
Header Units
Module Private Marker

Test your knowledge of modules.

Learn how to use the new operator <=> to easily make classes ordered

Source code

Comparison Operators - I
Comparison Operators - II
Three-way Comparison Operator - I
Three-way Comparison Operator - II
Three-way Comparison Operator - III
Three-way Comparison Operator - IV
Synthesized Expressions - I
Synthesized Expressions - II
Comparisons
Equality Operator - I
Equality Operator - II
Equality Operator - III
Ordering Categories
Strong Ordering
Weak Ordering - I
Weak Ordering - II
Partial Ordering - I
Partial Ordering - II
Ordering Summary
Backward Compatibility
Utilities - I
Utilities - II
Utilities - III
Utilities - IV
Summary

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Explores modules, which offer a faster and easier way to reuse existing functions or classes compared to header files, potentially improving build times and code organization
Covers ranges, which simplify working with containers and algorithms by eliminating the need for explicit begin() and end() function calls, leading to more concise and readable code
Discusses concepts, a new way of applying constraints on template arguments that is simpler to use compared to SFINAE (enable_if), helping to prevent runtime errors
Examines coroutines, which enable writing concurrent code without the need for synchronization or multiple threads, potentially leading to high-performance applications
Requires a basic understanding of C++11, so learners without this foundation may need to acquire it before taking this course, which may require additional time and resources
Focuses exclusively on C++20 features, so learners seeking a comprehensive introduction to C++ or a review of earlier standards may find it too specialized, which may not suit all learners

Save this course

Save Pure C++ 20 - raw & unfiltered to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Pure C++ 20 - raw & unfiltered with these activities:
Review C++11 Features
Solidify your understanding of C++11 features to prepare for the advanced C++20 concepts covered in this course. This will help bridge the gap and ensure a smoother learning experience.
Show steps
  • Review notes and examples from previous C++11 coursework.
  • Complete practice exercises focusing on lambda expressions, smart pointers, and move semantics.
  • Identify areas of weakness and seek clarification through online resources or documentation.
Review: Effective Modern C++
Deepen your understanding of modern C++ practices and idioms to better grasp the context and motivation behind C++20 features. This book provides valuable insights into the design decisions and trade-offs involved in modern C++ development.
Show steps
  • Read selected chapters focusing on topics relevant to C++20, such as move semantics and lambda expressions.
  • Experiment with the code examples provided in the book to reinforce your understanding.
  • Reflect on how the concepts discussed in the book relate to the C++20 features covered in the course.
Implement Comparison Operators
Reinforce your understanding of the three-way comparison operator by implementing it in various classes. This hands-on practice will solidify your knowledge of ordering categories and synthesized expressions.
Browse courses on Comparison Operators
Show steps
  • Create several classes with different data members.
  • Implement the three-way comparison operator for each class, considering different ordering categories (strong, weak, partial).
  • Test your implementations thoroughly to ensure they behave as expected.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Blog Post: C++20 Modules vs. Headers
Solidify your understanding of C++20 modules by creating a blog post that compares and contrasts them with traditional header files. This will help you articulate the benefits and drawbacks of each approach.
Browse courses on Modules
Show steps
  • Research the differences between C++20 modules and header files.
  • Write a blog post that explains the advantages and disadvantages of each approach.
  • Provide examples of how to use modules in a C++20 project.
  • Publish your blog post online.
Migrate a C++11/14 Project to C++20
Apply your knowledge of C++20 features by migrating an existing codebase. This project will provide practical experience in using modules, ranges, concepts, and other new features.
Show steps
  • Choose a C++11 or C++14 project to migrate.
  • Identify areas where C++20 features can be used to improve the code.
  • Implement the necessary changes, such as replacing headers with modules and using ranges instead of traditional loops.
  • Test the migrated code thoroughly to ensure it functions correctly.
C++ Concurrency in Action
Gain a deeper understanding of concurrency concepts to better appreciate the benefits of C++20 coroutines. This book provides a comprehensive overview of traditional concurrency mechanisms and their limitations.
Show steps
  • Read chapters related to threads, mutexes, and condition variables.
  • Compare and contrast the traditional concurrency mechanisms with C++20 coroutines.
  • Experiment with the code examples provided in the book to reinforce your understanding.
Contribute to a C++20 Library
Deepen your understanding of C++20 by contributing to an open-source library that utilizes its features. This will provide valuable experience in working with real-world code and collaborating with other developers.
Show steps
  • Find an open-source C++ library that uses C++20 features.
  • Identify a bug or feature request to work on.
  • Implement the necessary changes and submit a pull request.
  • Respond to feedback from other developers and revise your code as needed.

Career center

Learners who complete Pure C++ 20 - raw & unfiltered will develop knowledge and skills that may be useful to these careers:
Systems Programmer
A systems programmer works on the core components of an operating system, or other low-level software, and often must deal with performance and efficiency. This role requires deep familiarity with modern C++ features, including those introduced in C++20 such as modules, coroutines, and concepts. The Pure C++ 20 course will be especially helpful for a systems programmer by teaching them how to write performant code using the language's latest features, and how to effectively reuse code through modules. Since this role is often concerned with optimization, the course's discussion of compile time evaluation and the three way comparison operator will be quite useful.
Game Engine Developer
A game engine developer is responsible for building the core systems that drive video games. This involves creating high-performance software, and so an in-depth understanding of memory management, concurrency, and code optimization is critical. The Pure C++ 20 course, with its focus on new language features, will inform the game engine developer on how to best utilize modern C++ for performance. The course's instruction on coroutines for concurrency, use of the three way comparison operator, and ranges for algorithms will provide a significant improvement in understanding the language's latest capabilities. With this knowledge, a game engine developer can create better and more efficient game systems.
Embedded Systems Engineer
An embedded systems engineer develops software for devices with limited resources, such as microcontrollers and IoT devices. This role requires a strong grasp of low-level programming concepts along with an ability to write efficient, real-time code. The Pure C++ 20 course provides targeted education on the latest C++ standard and features which will help the embedded systems engineer. The course material on compile time evaluation, usage of char8_t, modules and coroutines will assist an embedded systems engineer in building high-performance and memory efficient software for resource constrained devices.
High Frequency Trading Developer
A high-frequency trading developer builds software for financial systems that require extremely low latency and high throughput. This role demands expertise in performance optimization and concurrency. This course provides targeted instruction on the latest features of the C++ standard, which will help a high frequency trading developer to write better software. With the course's focus on coroutines, modules, and compile time evaluation, the developer will gain a deeper understanding of the language's latest capabilities. These features are particularly useful for building high-performance trading systems. Additionally, the section on ranges will provide a developer with more performant ways to deal with data.
Compiler Engineer
A compiler engineer works on the design and implementation of compilers, which translate source code into machine code. This role necessitates deep understanding of language standards and the ability to optimize code generation. The Pure C++ 20 course provides the required information for a compiler engineer. The course's focus on the new C++20 language features, like modules, concepts, and coroutines, will help the engineer to understand how to implement these features in a compiler. This course is not a complete replacement for a deep knowledge of compiler theory, but it will deepen their understanding of the practical aspects of implementing a C++ compiler.
Quantitative Analyst
A quantitative analyst, often called a quant, uses mathematical and statistical models to analyze financial markets. While quants often use other tools, many also use C++ for its performance and control. The Pure C++ 20 course may be useful to a quant by teaching the latest C++ features, including coroutines, modules, and compile time evaluation. The course will help a quant leverage these features to develop performant financial models. The course will also provide understanding on how to use ranges for numerical algorithms. While they may not be the primary tool of a quant, understanding how to use modern C++ will bring additional value to their work.
Robotics Software Engineer
A robotics software engineer develops the software that controls robots and autonomous systems. This often entails real time processing, algorithmic efficiency, and strong understanding of hardware interaction. The Pure C++ 20 course may be useful to the robotics software engineer by teaching them about the latest language features that are useful for writing performant code. The course covers coroutines, modules, and concepts, all of which will permit a robotics engineer to implement efficient, maintainable, and scalable solutions to the challenges of robotics. They will be particularly interested in the material covering ranges and the three-way comparison operator.
Operating Systems Developer
An operating systems developer works on the core software that manages computer hardware and resources. This role demands in-depth knowledge of low-level programming and system architecture. The Pure C++ 20 course may be useful for an operating systems developer because it covers many of the latest features of the C++ language, including modules, coroutines, and concepts. With the knowledge gained from the course, an operating systems developer will be better equipped to create more efficient and robust kernel components. Their work may benefit from the course's coverage of compile time evaluation and the three-way comparison operator.
Database Developer
A database developer creates and maintains the systems that store and manage data. This role requires in-depth knowledge of data structures, algorithms, and performance optimization. The Pure C++ 20 course may be helpful for a database developer due to its focus on modern C++. The course's coverage of modules for code reuse and range based algorithms are particularly relevant to database development. The three way comparison operator may also be helpful for developers creating custom comparison functions. Although other tools are often used, C++ is often used for low level database management, and so this course is a good fit.
Scientific Software Developer
A scientific software developer builds and maintains software for scientific research and simulations. This role demands skills in numerical computing, performance optimization, and data processing. The Pure C++ 20 course may be useful to a scientific software developer because it introduces new C++ features. The course's material on ranges, modules, and concepts will be helpful to create more efficient and maintainable scientific simulations. Furthermore, the course's coverage of core language changes will help developers understand how to use the latest language features, which will improve the overall quality of their code.
Graphics Programmer
A graphics programmer works on visual aspects of software, including rendering, animation, and visual effects. This role requires a strong grasp of linear algebra, algorithms, and optimization techniques. The Pure C++ 20 course may be useful to a graphics programmer by discussing the new features that C++20 brings. The course discusses concepts, modules, and coroutines, which may permit a graphics programmer to write more efficient and maintainable graphics code. The course's discussion of ranges is particularly relevant for graphics developers who frequently handle data sets.
Financial Software Engineer
A financial software engineer develops, tests, and maintains software for financial institutions. This includes trading platforms, risk management systems, and back office applications. The Pure C++ 20 course may be useful to a financial software engineer as C++ is often used in the finance industry for performance reasons. The course teaches how to use the latest features of C++, including modules, coroutines, and concepts. A financial software engineer will also be interested in how to implement ranges and the three way comparison operator. They may not use C++ exclusively, but this course can help them if they do.
Machine Learning Engineer
A machine learning engineer builds and deploys machine learning models. This role requires expertise in algorithms, data structures, and statistical analysis. The Pure C++ 20 course may be useful to a machine learning engineer. While Python and other languages are often used, C++ is also used for lower level implementation of machine learning and AI algorithms. The course covers new language features, like modules, concepts, ranges, and coroutines, which will help a machine learning engineer write performant machine learning code. This course does not teach AI or machine learning directly, so the connection is more tenuous.
Data Scientist
A data scientist analyzes complex data to derive business insights. This role requires expertise in statistics, machine learning, and data visualization. The Pure C++ 20 course may be useful to a data scientist. C++ is used in some data science projects for its performance benefits. The new features of C++20, taught by this course, will help a data scientist use C++ more effectively. The course covers modules, ranges, and coroutines, which can be helpful for building data analysis pipelines. However, other technologies, like Python and R, are more commonly used, so the fit is not very strong.
Web Application Developer
A web application developer builds interactive web applications using various programming languages and frameworks. While the majority of web application development does not use C++, it can be used in some niche cases, especially for high performance servers, or in cases where C++ libraries are used through a bridge. The Pure C++ 20 course may be useful in that specific context, by providing knowledge about new C++ language features. A web application developer may be interested in the course's discussion of modules and coroutines, and the course will additionally serve to improve understanding of modern C++ in general. However, it is not typically required.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Pure C++ 20 - raw & unfiltered.
Provides a comprehensive guide to modern C++ features, including those introduced in C++11, C++14, and beyond. It offers practical advice and best practices for leveraging these features effectively. It is particularly helpful for understanding the nuances of move semantics, smart pointers, and lambda expressions, which are essential for mastering C++20. This book serves as an excellent reference for understanding the evolution of C++ and its modern idioms.
Provides a comprehensive guide to writing concurrent and multithreaded applications in C++. While the course touches on coroutines, this book provides a deeper dive into traditional concurrency mechanisms. It covers topics such as threads, mutexes, condition variables, and atomic operations. This book is particularly useful for understanding the challenges and complexities of concurrent programming in C++ and provides a solid foundation for understanding how coroutines simplify concurrent code.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser