Algorithm Optimizations - Advanced STL, Part 2

Algorithm Optimizations - Advanced STL, Part 2

  • Comments 5

Part 2 of my video lecture series exploring the Standard Template Library's implementation is now available.  In this part, I walk through how our STL algorithms equal() and copy() use template metaprogramming to detect when it's safe to call memcmp() and memmove(), which are potentially faster than the generic loops.


In Part 1's comments, two customers reported compiler bugs to us.  While I can't promise that they'll be fixed in VC11, I'm happy to report that fixes for them have been queued in our checkin system, which is certainly a prerequisite for shipping them.  :->


This advanced series assumes that you're familiar with C++ and the STL's interface, but not the STL's implementation.  If you haven't used the STL extensively yet, I recommend watching my introductory series.  For reference, here are all of the links:


[STL Introduction]

Part 1 (sequence containers)

Part 2 (associative containers)

Part 3 (smart pointers)

Part 4 (Nurikabe solver) - see Wikipedia's article and my updated source code

Part 5 (Nurikabe solver, continued)

Part 6 (algorithms and functors)

Part 7 (algorithms and functors, continued)

Part 8 (regular expressions)

Part 9 (rvalue references)

Part 10 (type traits)


[Advanced STL]

Part 1 (shared_ptr - type erasure)

Part 2 (equal()/copy() - algorithm optimizations)


Stephan T. Lavavej

Visual C++ Libraries Developer

  • This is a really great set of series!

    As someone who mostly works in C#, this series has been really helpful in terms of (re)building my knowledge of C++. (It was always a bit shaky to begin with as I mostly went from C to C++-as-C-with-objects to a long hiatus from programming to C#). I'm still working my way through the STL Introduction series, but I've enjoyed every one that I've watched and have been growing more confident in my C++ knowledge. Keep up the great work!

  • I was genuinely interested in watching the videos about nurikabe solver. Unfortunately, the guy talks painfully too much, so I gave up watching after around 15 mins. The video could be shortened at least to half of its lenght without any loss of content.

  • MikeBMcL: I'm very happy to hear that!

    Zeljko Vrba: I probably could have been more concise - in the early videos I was still learning how to cram everything into 45 minutes. (As I recall, even given 2 parts, I didn't have time to cover the last function of the solver.) However, please remember that the early videos are targeted at programmers who are new to the STL and haven't worked with things like vector, set, and shared_ptr before. My solver used the STL intensively, so I decided to err on the side of explaining too much rather than too little. If you're already acquainted with the STL, then some or most of the explanations will be unnecessary to you, especially if you can look at a data structure's type and immediately see its purpose. In that case, I invite you to read my code in silence, and consult the video if I'm doing something that's not obvious at first glance.

  • Strongly disagree with the sentiment that these videos are "too talky". There are a lot of really useful informational nuggets in these lectures, and I appreciate each and every one of them!

  • I started to watch STL series long time ago, but stopped at first episode. Now I watched all and must say is excellent and all information is given is a simple way, so is easy to understand what is talking about. Thank for you series.

Page 1 of 1 (5 items)