Video Introduction to the STL, Part 3

Video Introduction to the STL, Part 3

  • Comments 5

The third part of my video lecture series introducing the Standard Template Library is now available, following Part 1 and Part 2.  Part 3 covers unique_ptr, shared_ptr, and exception handling (briefly).  It explains my solution to the container erasure problem, and presents a significantly larger homework problem: writing a Nurikabe solver.

 

In Part 4, the pieces that we've seen (sequence containers, associative containers, and smart pointers) will fall into place, and I'll walk through how my Nurikabe program works.

 

Stephan T. Lavavej

Visual C++ Libraries Developer

  • Hello, awesome presentations.  I like how they are ramping up, keep them coming!

    I have a question, not about this presentation, but I'm not sure where to ask.  In VS 2010 I was trying out the lambda functions and the scope seems to be based off the old scoping rules (at least I think the standard has been updated, but maybe it's just a proposal.)  Do you know if there are any plans in your service pack to update the lambda scoping to match this:

    wiki.dinkumware.com/.../n2998.html

    I apologize for the off-topic question.

  • Yes, the C++0x Working Paper's rules changed from what I refer to as lambdas v1.0 (implemented by VC10 RTM) to lambdas v1.1, which I mentioned here: blogs.msdn.com/.../c-0x-core-language-features-in-vc10-the-table.aspx

    We have implemented lambdas v1.1, but because the changes are nontrivial, I suspect that they will not be backported to VC10. (I would love to be proven wrong.)

  • Thank you for the clarification!  I would also love for you to be proven wrong on that point ;).  It would be a shame to have to wait a few years to get a new version with the new scoping rules.  I of course understand time constraints mean not everything can be done at once.  It's just a shame you can't iterate over a nested set of containers with a standard algorithm without encountering this issue.

    I wanted to say one more thing, on topic, about your video.  I appreciate the explanation of auto_ptr (being deprecated), shared_ptr, and unique_ptr.  I've been using C++ for quite a while, and I heard there were issues with auto_ptr so I never used it, and I never really investigated boost's shared_ptr, so I've been working with bare pointers (and have been careful about it).  With C++0x including shared_ptr and unique_ptr this means it is easily accessible and makes a lot of sense to use.

    Because of your video I've had the opportunity to re-visit some of my personal projects and begin redesigning the use of pointers to instead use these RAII pointer containers which should make everything much safer.  Very cool stuff!

  • I'm very glad to hear that! If you haven't seen it, my shared_ptr slide deck at blogs.msdn.com/.../tr1-slide-decks.aspx is a comprehensive introduction (the only thing that it doesn't cover is C++0x/VC10's make_shared<T>(), since it's a couple of years old).

  • You mention that shared_ptr is not meant to point at an array of objects. And, you also added that we shouldn't be leveraging the deleter for a shared_ptr to do that. Am wondering why?

    Is it because the who point of using these is to avoid situations where the programmer forgets to mention the deleter? I understand vector is far more superior to plain old array but sometimes you want to use the plain old arrays.

Page 1 of 1 (5 items)