Skip to content

Recommended Book: C++ Standard Library Practical Tips

All of my commercial software development experience is with Java. The lion’s share of my experience on personal projects is split between Java and C. I’ve used C++ for a few projects, I know enough of the language to avoid some of the common pitfalls, but I’m far from being an expert. I’m also keenly aware of where my knowledge of C++ is lacking. Perhaps the biggest gap in my knowledge base is with the standard library.

Anytime I work with C++ I generally do not use the standard library. I learned the language during a time when the STL’s reputation was less than stellar thanks to poor implementations by major compiler vendors. Because the STL was officially part of the standard library, I tended to avoid other standard library constructs as well, such as iostreams and strings. I also contribute this to my experience with C. Character arrays and stdio have never scared me and all of the hype about type-safety and namespaces was just hype to me. Were I using the language in a commercial environment I might have thought differently.

I was browsing a book store the other day in an affluent commercial district in Seoul (an area known as Korea’s Silicon Valley) when I stumbled across a book I’d never heard of, C++ Standard Library Practical Tips. It just so happens that I have been considering C++ for one of the (too many) projects I have in the queue. Since the standard library is one of my biggest C++ weaknesses I decided to buy the book. It helped that Charles River Media publishes it. I have quite a few CRM books now and have not been disappointed by any of them.

The book follows a format that has been successful in the industry. It is organized into several sections (chapters in this case) which contain a collection of individual tips. You can read the book cover-to-cover, but it can also to be used as a reference to help you solve specific problems as you encounter them. The first chapter gives an introduction to and history of the C++ standard library. Chapter two gives an overview of that part of the library which used to be called, and still is referred to as, the STL. By the end of Chapter 2 I had already filled in some of those gaps of mine.

The meat of the book, the tips, begins in Chapter 3. There are 100 tips in all covering several different aspects of the library. The first few tip groups are related to the STL: Chapter 3 covers containers in general, 4 is about vectors, 5 (a short one) about deques, 6 covers lists, 7 gives tips about associative containers, and 8 wraps up with other containers. Chapter 9 moves on to alogrithms, 10 has sixteen tips about text processing (strings), 11 is the biggest chapter of the book with 22 tips on numerical processing, and chapter 12 closes the tip collection with 3 tips on STL implementations and the sharing of information. Chapter 13 puts the preceding tips to use in an application that does digital image processing (a great chapter by itself). Finally, there is an Appendix which gives more information on STL algorithms and references for further study.

My casual relationship with C++ has taken a major leap forward thanks to this book. I give it 6 out of 5 stars. I mean it. It’s perfect for both beginning and intermediate C++ programmers as learning material, but it also makes an excellent reference for anyone. I now feel comfortable not only with using STL containers, but also with deciding which to use in different situations. I have a much better understanding of the algorithms the standard library provides, as well as ranges and the different types of iterators. Before I read this book, I wasn’t even aware there were different types of iterators (other than forward and reverse). I now can also create my own iterator if I need to.

As much as I enjoy working with Java and D, there is no denying that C++ is the lingua franca of the game industry at present. While I’m a big advocate of learning as many languages as reasonably possible, C++ is certainly one that you ought to have more than passing familiarity with. If you want to improve your knowledge of the standard library or just need to have a good reference handy, Greg Reese’s C++ Standard Library Practical Tips fits the bill nicely. It’s one of those rare books that will spend more time on your desk than on your bookshelf.

Technorati Tags: , , , ,

Post a Comment

Your email is never published nor shared. Required fields are marked *