In Part 3 of my video lecture series exploring the Standard Template Library’s implementation, I explain how our powerful correctness checks in debug mode work.  In VC10, they’re controlled by the macro _ITERATOR_DEBUG_LEVEL, which supersedes VC8 and VC9’s more confusing _SECURE_SCL and _HAS_ITERATOR_DEBUGGING macros.  Additionally, VC10’s #pragma detect_mismatch allows the linker to detect badness that previously would have caused incomprehensible crashes.  Finally, I demonstrate the undocumented and unsupported but exceedingly awesome compiler option /d1reportSingleClassLayout which prints an ASCII art diagram of a class’s representation.


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)

Part 3 (_ITERATOR_DEBUG_LEVEL, #pragma detect_mismatch, and /d1reportSingleClassLayout)


Stephan T. Lavavej

Visual C++ Libraries Developer