CppCon 2019 has ended
Back To Schedule
Friday, September 20 • 10:30 - 11:30
The Smart Pointers I Wish I Had

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

C++ offers two owning smart pointers, and a proposed non-owning smart pointer in the C++20 Library Fundamentals v2 Technical Specification. This talk will cover the kinds of semantics I think are important in a non-owning pointer, why I think more than one is desirable, and why the existing C++ owning smart pointers are sub-optimal for some use-cases. I will show how correct use of non-owning smart pointers can reduce memory lifetime issues, clarify code, and nearly eliminate incorrect ownership.

For asynchronous programming especially, the lifetime of observing pointers can be a source of significant and difficult to debug issues. I'll cover a mental model to use when writing code that helps focus on where lifetime issues might be likely, and where they will be unlikely.

avatar for Matthew Fleming

Matthew Fleming

Software Engineer, Pure Storage
I've been working in systems software for almost 20 years now, mostly on virtual memory and filesystems, in both C and C++. I tend to find myself gravitating lower and lower in the stack, to code primitives, library helpers, and getting very close to the hardware.

Friday September 20, 2019 10:30 - 11:30
Summit 8/9

Attendees (132)