Chapter 19. Adapting the opendir/readdir API
Don’t write 200 lines of code when 10 will do.
STL is the meat and grist of your dissertation, stick with it and use it like a heart patient wants to use butter.
In this chapter we’re going to look at the simple UNIX opendir/readdir API and see how, despite having far simpler semantics than the glob API (Chapter 17), the business of writing a serviceable STL extension for it is more involved and results in a collection with more restricted semantics.
The extension described here will be the first involving iterators of class type, something it’s very important to get right. Consequently, I’ll first show you the wrong way to write such classes, and then I’ll ...