C++20 Concepts & Coroutines (The Order Book)
Channel: Sonia Kolasinska
Date: 29/03/2023

The Order Book -- C++20 Concepts & Coroutines -- A long journey from C++98

I invite you to watch my tech talk (fun talk), where I'm bringing you on a journey from C++98 to C++20.

I'm presenting practical use of the new features in C++20 that were so missing back in time when in '00's we were limited by C++98 and compilers weren't fully compliant.

My talk starts by me explaining the basics of The Order Book, which is at the core of any asset exchange and trading. And then I walk through basic implementation of the Order Book in good old C++98.

After that I introduce an abstract class with a virtual method, as an introduction to a problem, which next we will solve using C++ templates and C++20 concepts.

I explain the analogy between C++ templates and functions, and C++ concepts and interfaces.

I also present how coroutines can be used by an implementation of The Order Book to apply asynchronous order execution policy and also to yield executions back to the user.

At the end of the talk I present live demo, and I talk about the benefits of using C++20. I show the error messages that happen when concepts are not satisfied, and compare with C++98.

Your CC are very welcome!

See project on GitHub: https://github.com/sadhbh-c0d3/cpp20-orderbook#c20-order-book

Chapters:
0:00:00 Start
0:00:44 Overview - What is Order Book?
0:05:36 Architecture Review
0:06:50 Classic C++98 - Definitions & Basic Implementation
0:12:50 Classic C++98 - Order Book
0:16:08 Classic C++98 - In-Sorting Price Levels
0:19:55 C++20 auto interlude - Adding auto
0:24:02 Abstract Base - Run-Time Polymorphism
0:28:22 Static Polymorphism - Templates
0:33:22 Concepts - Introduction
0:35:51 Concepts - SOLID Principles
0:41:12 Concepts - Book Side Concept
0:45:20 Concepts - Price Traits
0:51:18 Concepts - 2nd Order Templates
0:56:36 Concepts - Price Level Lookup Policy
1:00:08 Concepts - Book Side Policy
1:04:39 Order Matching - Introduction
1:07:19 Order Matching - Algorithm
1:13:27 Co-Routines - Introduction
1:15:07 Co-Routines - Algorithm
1:22:40 Improvements
1:33:58 2nd Order Concepts Workaround
1:40:46 Demo - Introduction
1:43:00 Demo - Order Data Type
1:45:35 Demo - Concept Error
1:49:03 Demo - Main Walk Thru
1:51:25 Conclusions
2:07:02 Thank You!

DISCLAIMER: In this presentation I am not using typical CppCon style language, I do not go over details of C++ grammar, or details of how to abuse C++ features. This presentation is about showing Concepts and Coroutines on practical example of The Order Book. I show how features of modern C++ can be used to achieve code following SOLID principles. I also explain choices I have made during the development.