CppCon 2019 has ended
Back To Schedule
Friday, September 20 • 13:30 - 14:30
Back to Basics: Type Erasure

Log in to save this to your schedule, view media, leave feedback and see who's attending!

This talk, based on Arthur's blog post ["What is Type Erasure?"](https://quuxplusone.github.io/blog/2019/03/18/what-is-type-erasure/), will explain the notion of type erasure as seen in standard library types such as std::function and std::any. We'll see how to build the most naive form of type erasure using heap allocation and virtual functions; then iteratively optimize that design to improve its performance. At the extreme, we'll see how C++2a std::function_ref achieves trivial copyability.

Attendees will leave this session confident in their ability to implement type-erased classes, such as std::function, from scratch.

avatar for Arthur O'Dwyer

Arthur O'Dwyer

C++ Trainer
Arthur O'Dwyer is the author of "Mastering the C++17 STL" (Packt 2017) and of professional training courses such as "Intro to C++," "Classic STL: Algorithms, Containers, Iterators," and "The STL From Scratch." (Ask me about training your new hires!) Arthur is occasionally active on... Read More →

Friday September 20, 2019 13:30 - 14:30 MDT
Aurora A