Uploaded January 2026 | Updated September 2026, 2 weeks ago
cppcon.org
---
Rust Trait Runtime Polymorphism in C++ - Eduardo Madrid - CppCon 2025
---
We built a library to support runtime polymorphism in the style of Rust Traits. C++ libraries ought to provide composable abstractions with zero-overhead, and this library may yield those benefits compared to idiomatic Rust runtime polymorphism (traits). Remarkably, the library also improves upon the very feature of C++ for runtime polymorphism, virtual dispatch. Thus, with this library we can enjoy the benefits of traits knowing we won't have to pay performance or object code size for the privilege.
Still, why would we want to use this design option?
This presentation will illustrate by examples how Traits give us a way to avoid the hard problems of the normal design choice of inheriting from an object-oriented interface. Then, we will study how traits are supported, and how and why performance/object code size can be improved. You may anticipate that part of the reason is that this is a library rather than a programming language feature, and as such, it gives users freedoms that language features inherently deny — more reason to study these choices. Perhaps this new context surfaces improvements to Rust’s trait mechanism.
Looking deeper at traits we see the following:
- For starters, we don’t have to modify already-great types —especially those we don’t own. We just provide the trait functions' implementations separately: no subclassing, no wrappers, and no struggles to retrofit new polymorphism to existing codebases, just new code.
- Inheritance has problems of rigidity, traits void the need to use inheritance
- Traits decouple behaviors from hierarchies of inheritance, allowing clean composition of functionality.
- In particular, no fragile base classes: no challenge of changing a base with unexpected consequences.
- There’s no tight coupling between interfaces and implementations - - Traits are opt-in behavior.
- Dynamic dispatch is explicit and type-safe
- Also polymorphism with value semantics! -
Finally, the programming techniques devised in this framework to support Rust Traits, such as the automatic building of constexpr virtual tables, might be applicable on their own to unrelated things.
We will show how C++ is so powerful that you can incorporate wholesale good ideas from other languages and improve.
---
Slides: github.com/CppCon/CppCon2025/blob/main/Presentations/Rust_Traits_in_Style_for_Cpp.pdf
Work at Hudson River Trading (HRT): tinyurl.com/safxfctf
---
Eduardo Madrid
Eduardo has been working for many years on financial technologies, automated trading in particular, and other areas where performance challenges can be solved in C++. He contributes to open source projects and teaches advanced courses on Software Engineering with emphasis in Generic Programming
---
CppCon is the annual, week-long face-to-face gathering for the entire C++ community. The conference is organized by the C++ community for the community. You will enjoy inspirational talks and a friendly atmosphere designed to help attendees learn from each other, meet interesting people, and generally have a stimulating experience. Taking place this year in Aurora, Colorado, near the Denver airport, and including multiple diverse tracks, the conference will appeal to anyone from C++ novices to experts.
Annual CppCon Conference - cppcon.org
linkedin.com/company/cppcon
https://x.com/cppcon
facebook.com/CppConference
reddit.com/r/cppcon
https://mastodon.social/@CppCon
---
Videos Filmed & Edited by Bash Films: BashFilms.com
YouTube Channel Managed by Digital Medium Ltd: events.digital-medium.co.uk
---
#cpp #cplusplus #cppcon #cppprogramming #cplusplusprogramming #softwaredevelopment #softwareengineering #coding #code #computerscience #technology #technews #programming #programmer
cppcon.org
---
Rust Trait Runtime Polymorphism in C++ - Eduardo Madrid - CppCon 2025
---
We built a library to support runtime polymorphism in the style of Rust Traits. C++ libraries ought to provide composable abstractions with zero-overhead, and this library may yield those benefits compared to idiomatic Rust runtime polymorphism (traits). Remarkably, the library also improves upon the very feature of C++ for runtime polymorphism, virtual dispatch. Thus, with this library we can enjoy the benefits of traits knowing we won't have to pay performance or object code size for the privilege.
Still, why would we want to use this design option?
This presentation will illustrate by examples how Traits give us a way to avoid the hard problems of the normal design choice of inheriting from an object-oriented interface. Then, we will study how traits are supported, and how and why performance/object code size can be improved. You may anticipate that part of the reason is that this is a library rather than a programming language feature, and as such, it gives users freedoms that language features inherently deny — more reason to study these choices. Perhaps this new context surfaces improvements to Rust’s trait mechanism.
Looking deeper at traits we see the following:
- For starters, we don’t have to modify already-great types —especially those we don’t own. We just provide the trait functions' implementations separately: no subclassing, no wrappers, and no struggles to retrofit new polymorphism to existing codebases, just new code.
- Inheritance has problems of rigidity, traits void the need to use inheritance
- Traits decouple behaviors from hierarchies of inheritance, allowing clean composition of functionality.
- In particular, no fragile base classes: no challenge of changing a base with unexpected consequences.
- There’s no tight coupling between interfaces and implementations - - Traits are opt-in behavior.
- Dynamic dispatch is explicit and type-safe
- Also polymorphism with value semantics! -
Finally, the programming techniques devised in this framework to support Rust Traits, such as the automatic building of constexpr virtual tables, might be applicable on their own to unrelated things.
We will show how C++ is so powerful that you can incorporate wholesale good ideas from other languages and improve.
---
Slides: github.com/CppCon/CppCon2025/blob/main/Presentations/Rust_Traits_in_Style_for_Cpp.pdf
Work at Hudson River Trading (HRT): tinyurl.com/safxfctf
---
Eduardo Madrid
Eduardo has been working for many years on financial technologies, automated trading in particular, and other areas where performance challenges can be solved in C++. He contributes to open source projects and teaches advanced courses on Software Engineering with emphasis in Generic Programming
---
CppCon is the annual, week-long face-to-face gathering for the entire C++ community. The conference is organized by the C++ community for the community. You will enjoy inspirational talks and a friendly atmosphere designed to help attendees learn from each other, meet interesting people, and generally have a stimulating experience. Taking place this year in Aurora, Colorado, near the Denver airport, and including multiple diverse tracks, the conference will appeal to anyone from C++ novices to experts.
Annual CppCon Conference - cppcon.org
linkedin.com/company/cppcon
https://x.com/cppcon
facebook.com/CppConference
reddit.com/r/cppcon
https://mastodon.social/@CppCon
---
Videos Filmed & Edited by Bash Films: BashFilms.com
YouTube Channel Managed by Digital Medium Ltd: events.digital-medium.co.uk
---
#cpp #cplusplus #cppcon #cppprogramming #cplusplusprogramming #softwaredevelopment #softwareengineering #coding #code #computerscience #technology #technews #programming #programmer





![Making C++ Safe, Healthy, and Efficient - John Lakos - CppCon 2025
https://cppcon.org
Making C++ Safe, Healthy, and Efficient - John Lakos - CppCon 2025
The world runs on C++. For more than two decades, C++ has served as the workhorse of high-performance, low-power, and low-latency software across industries. Its raw speed and unconstrained flexibility have made C++ the go-to language for and backbone of large-scale software development. Recently, however, software engineering priorities have shifted significantly toward safety. While C++ enables the creation of secure and correct programs, its traditional focus has favored performance over safety guarantees. As the software landscape evolves, C++ faces a crucial inflection point. To maintain its unparalleled stature, C++ must embrace various safety mechanisms along with safety-by-default principles to support a broader developer ecosystem while preserving the performance capabilities that experts will continue to demand. This talk will examine C++s evolution toward safety-first development, analyzing functional, language, memory, lifetime, and data-race safety considerations. We survey existing safety techniques, identify current limitations, and explore potential solutions for remaining security challenges. Finally, we present a comprehensive roadmap for achieving robust safety guarantees in C++26 and beyond, while continuing to enable all the language’s performance advantages.
Slides: https://github.com/CppCon/CppCon2025/blob/main/Presentations/What_C++_Needs_To_Be_Safe.pptx
Work at Hudson River Trading (HRT): https://tinyurl.com/safxfctf
John Lakos
John Lakos, author of Large-Scale C++ Software Design [Addison-Wesley, 1996], serves at Bloomberg LP in New York City as a senior architect and mentor for C++ software development worldwide. He is also an active voting member of the C++ Standards Committee’s Evolution Working Group. Previously, Dr. Lakos directed the design and development of infrastructure libraries for proprietary analytic financial applications at Bear Stearns. For 12 years prior, Dr. Lakos developed large frameworks and advanced ICCAD applications at Mentor Graphics, for which he holds multiple software patents. His academic credentials include a Ph.D. in Computer Science (97) and an Sc.D. in Electrical Engineering (89) from Columbia University. Dr. Lakos received his undergraduate degrees from MIT in Mathematics (82) and Computer Science (81). He is the author of Large-Scale C++ — Volume I: Process and Architecture [Addison-Wesley, 2020], the first book in a three-part series, and a coauthor of Embracing Modern C++ Safely [Addison-Wesley, 2021] with Vittorio Romeo along with Rostislav Khlebnikov and Alisdair Meredith.
CppCon is the annual, week-long face-to-face gathering for the entire C++ community. The conference is organized by the C++ community for the community. You will enjoy inspirational talks and a friendly atmosphere designed to help attendees learn from each other, meet interesting people, and generally have a stimulating experience. Taking place this year in Aurora, Colorado, near the Denver airport, and including multiple diverse tracks, the conference will appeal to anyone from C++ novices to experts.
Annual CppCon Conference - https://www.cppcon.org
https://www.linkedin.com/company/cppcon
https://x.com/cppcon
https://www.facebook.com/CppConference
https://www.reddit.com/r/cppcon/
https://mastodon.social/@CppCon
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd: https://events.digital-medium.co.uk
#cpp #cplusplus #cppcon #cppprogramming #cplusplusprogramming #softwaredevelopment #softwareengineering #coding #code #computerscience #technology #technews #programming #programmer Making C++ Safe, Healthy, and Efficient - John Lakos - CppCon 2025](https://i.ytimg.com/vi/p52mNWsh-qs/mqdefault.jpg)




