Loading…
CppNorth 2025, The Canadian C++ Conference
July 20-23, 2025 • Toronto, Canada
Monday July 21, 2025 14:30 - 15:30 EDT
Type erasure is a powerful concept in C++ that allows us to work with heterogeneous types while hiding their concrete details behind a generic interface. In this talk, we will explore how the C++ Standard Library employs type erasure in constructs like std::function, std::shared_ptr, and std::any to provide flexible and efficient solutions for managing types at runtime. Further, we will unveil the hidden cost of using these constructs.
We will start by building our own version of std::function, which will help demystify how it can store and call any callable object, regardless of its type. Then, we'll look at how std::shared_ptr uses type erasure to maintain type safety via dynamic dispatch of the deleter. Finally, we will delve into std::any, some times claimed the modern void*, and explore a different technique of type erasure.
Speakers
avatar for Sarthak Sehgal

Sarthak Sehgal

Sarthak Sehgal is an early-career C++ Software Engineer at a high frequency options market making firm. His interests lie in low level programming, performance optimization, and finance. Blog: sartech.substack.com... Read More →
Monday July 21, 2025 14:30 - 15:30 EDT
TBA-B

Attendees (1)


Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Share Modal

Share this link via

Or copy link