diff --git a/presentations/protocol_2026_05_11.md b/presentations/protocol_2026_05_11.md new file mode 100644 index 0000000..9787ccb --- /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++ +