From 53cc6e453b64c44016731dedfdb9fb956b681e05 Mon Sep 17 00:00:00 2001 From: "Jonathan B. Coe" Date: Mon, 11 May 2026 16:07:00 +0100 Subject: [PATCH 1/3] Add presentation for lightning talk at C++ London --- presentations/protocol_2026_05_11.md | 217 +++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 presentations/protocol_2026_05_11.md diff --git a/presentations/protocol_2026_05_11.md b/presentations/protocol_2026_05_11.md new file mode 100644 index 0000000..01ab4f1 --- /dev/null +++ b/presentations/protocol_2026_05_11.md @@ -0,0 +1,217 @@ +--- +marp: true +theme: default +paginate: true +size: 16:9 +#footer: https://github.com/jbcoe/cc-protocol +--- + +# Structural Subtyping for C++ + +## [P4148R0](https://wg21.link/P4148R0) + +### 11 May 2026 + +--- + +# Introduction + +We propose adding two new class templates to the C++ Standard Library to support structural sub-typing at runtime: + +```c++ +template > +class protocol; +``` + +```c++ +template +class protocol_view; +``` + +--- + +# Polymorphism + +polymorphism (from the Greek for "many forms") is the ability of different objects to respond to the same function call in their own specific ways. + +C++ achieves polymorphism through mechanisms: Compile-time and Runtime. + +--- + +# Compile-time Polymorphism + +Overloaded functions or function templates allow the compiler to detemrine which function to call during the build process: + +```c++ +double func(const A& a); +double func(const B& b); +double func(const C& c); +``` + +```c++ +