C9 Lectures: Stephan T Lavavej - Advanced STL, 1 of n
- Posted: Feb 10, 2011 at 12:47 PM
- 115,129 Views
- 105 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
As promised, the great Stephan T. Lavavej is back! Tens of thousands of you have watched STL's (those are his initials, so that's what we call him) introductory series on the STL, or Standard Template Library. If you haven't, you should. This series, Advanced STL, will cover the gory details of the STL's implementation -> you will therefore need to be versed in the basics of STL, competent in C++ (of course), and able to pay attention! Stephan is a great teacher and we are so happy to have him on Channel 9, and C9 is the only place you'll find this level of technical detail regarding the internals of the STL. There are no books. There are no websites. This is Stephan taking us into what is uncharted territory for most of us, even those with a more advanced STL skill set.
In the first part of this n-part series, Stephan digs deeply into shared_ptr. As you already know (since you will have the perquisites in place in your mind before watching this—remember, watch the intro series first), shared_ptr is a wrapper of sorts: it wraps a reference-counted smart pointer around a dynamically allocated object. shared_ptr is a template class (almost everything in the STL is a template, thus the name...) that describes an object (int, string, vector, etc.) that uses reference counting to manage resources. A shared_ptr object effectively either holds a pointer to the resource that it owns or holds a null pointer. A resource can be owned by more than one shared_ptr object, and when the last shared_ptr object that owns a particular resource is destroyed, the resource is freed.
You will also learn a lot about the beauty and the weirdness inside the STL. You should take Stephan's wisdom to heart and see if you can implement some of the patterns he shares with you in your own code, and you should of course take his advice about what NOT to do in your native compositions.
Welcome back, STL!!!
Tune in. Enjoy. Learn.
Part 1 (shared_ptr - type erasure)
Part 2 (equal()/copy() - algorithm optimizations)
Part 3 (_ITERATOR_DEBUG_LEVEL, #pragma detect_mismatch, and /d1reportSingleClassLayout)
Part 4 (rvalue references v2.1 and associative container mischief)