C++Now 2019 has ended
Back To Schedule
Thursday, May 9 • 16:30 - 18:00
An Alternate Smart Pointer Hierarchy

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

Feedback form is now closed.
C++ offers two-ish smart pointer types, std::unique_ptr<> and std::shared_ptr<>, with their own advantages and disadvantages. But what if these didn't exist, and your company wanted to create smart pointers to capture ownership semantics? Pure Storage had to create smart pointers for ourselves in 2009, and we rarely use the C++ smart pointers. I will discuss the semantics of our smart pointers: owned<> and delete_ptr<>, the conventions we have regarding them, and how they differ from C++'s offerings. owned<> has some advantages over unique and shared pointer, including the fact that changing from single ownership to multiple ownership doesn't change the name of the type, unlike unique -> shared.

We have additional derivations from the basic owned<> type that express ownership but also separate the view of the data from the ownership; this also has similarities to how the C++ smart pointers allow for a Deleter that is separate from the specified pointer type.

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.

Thursday May 9, 2019 16:30 - 18:00 MDT