C++Now 2018: Louis Dionne “Runtime Polymorphism: Back to the Basics”
CppNow
View ChannelAbout
#cppnow #cplusplus #cpp #cplusplusprogramming #cplusplustutorial #cpptutorial
Latest Posts
Video Description
http://cppnow.org — Presentation Slides, PDFs, Source Code and other presenter materials are available at: http://cppnow.org/history/2018/talks/ — C++ solves the problem of runtime polymorphism in a very specific way. It does so through inheritance, by having all classes that will be used polymorphically inherit from the same base class, and then using a table of function pointers (the virtual table) to perform dynamic dispatch when a method is called. Polymorphic objects are then accessed through pointers to their base class, which encourages storing objects on the heap and accessing them via pointers. This is both inconvenient and inefficient when compared to traditional value semantics. As Sean Parent said: Inheritance is the base class of evil. It turns out that this is only one of many possible designs, each of which has different tradeoffs and characteristics. This talk will explore the design space for runtime polymorphism in C++, and in particular will introduce a policy-based approach to solving the problem. We will see how this approach enables runtime polymorphism with stack-allocated storage, heap-allocated storage, shared storage, no storage at all (reference semantics), and more. We will also see how we can get fine-grained control over the dispatch mechanism to beat the performance of classic virtual tables in some cases. The examples will be based on a real implementation in the Dyno library [1], but the principles are independent from the library. At the end of the talk, the audience will walk out with a clear understanding of the different ways of implementing runtime polymorphism, their tradeoffs, and with guidelines on when to use one implementation or another. [1]: https://github.com/ldionne/dyno — Louis Dionne Amazon Software Engineer Louis is a math and computer science enthusiast with interest in C++ (meta)programming, functional programming, domain specific languages and related subjects. He is a member of the C++ Standards Committee and of the Boost community, where he authored the Boost.Hana metaprogramming library. — Videos Filmed & Edited by Bash Films: http://www.BashFilms.com --- *--* ---
Essential C++ Developer Tools
AI-recommended products based on this video

BOSGAME Linux Mini PC, Intel 12th N100 16GB DDR4 RAM 512GB SSD Linux Server Computers Preinstalled Ubuntu 22.04,Support 4K Triple Display/USB3.2/WiFi 5/2.5GbE

10.1 Inch Touch Portable Monitor IPS Screen 1366x768P 60Hz 400 Brightness 99% sRGB HDMI USB-C Monitors Switch for Xbox PS3/4/5 Laptop Compatible with Raspberry Pi, Mini Touch Screen




