October 2004
Intermediate to advanced
240 pages
6h 22m
English
Safety first (see Item 6): Use a checked STL implementation, even if it’s only available for one of your compiler platforms, and even if it’s only used during pre-release testing.
Just like pointer mistakes, iterator mistakes are far too easy to make and will usually silently compile but then crash (at best) or appear to work (at worst). Even though your compiler doesn’t catch the mistakes, you don’t have to rely on “correction by visual inspection,” and shouldn’t: Tools exist. Use them.
Some STL mistakes are distressingly common even for experienced programmers:
• Using an invalidated or uninitialized iterator: The former in particular is easy to do.
• Passing an out-of-bounds index: ...