March 19th, 2008 — shared_ptr, Or: How I Learned To Stop Worrying And Love Resource Management — Stephan T. Lavavej

Published: Sat 01 March 2008
By nwcpp

In 2008.


Building 41
One Microsoft Way
Redmond, Washington 98052


shared_ptr is the most powerful addition to the Standard C++ Library since the STL itself. This presentation begins with an overview of shared_ptr’s design and the philosophy behind it. Next, important uses of shared_ptr are explained in detail—shared_ptr isn’t just for sharing! Of course, new technologies come with new pitfalls. Fortunately, shared_ptr’s pitfalls, covered here, can be easily avoided. This presentation ends with advanced topics: thread safety, custom deleters, custom allocators, other C++0x features, and a tour of shared_ptr’s internals as implemented by Dinkumware. Whether you haven’t had a chance to use shared_ptr yet, or you’ve done everything but implement it, this presentation should be useful to you.


Stephan T. Lavavej, who frequently uses his auspicious initials, joined the Visual C++ Libraries team in January 2007. He mainly works on the Standard C++ Library, doing things like fixing epic conformance bugs and nuking iterator bloat. Recently, he’s worked with Dinkumware to integrate their TR1 implementation as part of the Visual C++ 2008 Feature Pack.

He originally joined Microsoft in July 2004, after receiving the degree of Bachelor Of Science With Honor in Computer Science from the California Institute Of Technology, and worked on Outlook 2007 Search. Among other things, he implemented hit highlighting, making stuff light up yellow.

His favorite data structure is the vector. His second favorite data structure is the suffix tree, which can be used to sort the suffixes of a string in linear time, because that can be used to implement his favorite algorithm, the Burrows-Wheeler Transform, and also because it sounds totally impossible.


Download the slides from the presentation.