文件名称:c++ standard library practical tips
文件大小:5.5MB
文件格式:RAR
更新时间:2012-07-13 07:16:41
c++ standard library practical tips
For the last 10 or so years, I’ve been programming in C++. I really enjoy the language for its power, brevity, and accommodation of three major programming styles—structured programming, object-oriented programming, and generic programming. In addition, C++ has a powerful and concise library that comes with every compiler that conforms to the language standard. Unfortunately, the library is not the easiest thing in the world to learn and use. And, although there are many good C++ textbooks and some very good C++ Standard Library reference books (my copy of Nicolai Josuttis’s excellent The C++ Standard Library is falling apart from use), I haven’t found any works that provide quick, concise, Standard Library solutions to practical programming problems. So, necessity being the mother of invention, I wrote this book to fill that gap. The book’s primary audience is new and intermediate C++ Standard Library programmers. They can be in any application area that uses C++, such as graphics programming, multimedia development, scientific computation, or financial software. They often have titles like Programmer, Software Engineer, Software Developer, or Applications Developer. People in this target audience should have a moderate amount of experience programming C++. This might include a course in the language, studying any of the plethora of C++ textbooks or tutorials, and perhaps even a year or two of actual programming experience. These programmers should also have some experience, even if it is minimal, using the Standard Library. For example, they should be able to call the Standard Library functions and understand the rudiments of templates and Standard Library containers. However, they do not need to know what parts of the Standard Library they should use to solve their programming problems. After all, that’s the point of this book! The book is organized in a way that lets you quickly find the answer to your programming problem. The heart of the book is the 100 tips on using the C++ Standard Library. They’re all short—about two to four pages each. Just look at the tip titles in the table of contents and flip to one you’re interested in. You’ll notice that each tip starts with a short solution. This is a very concise answer to the programming problem. If you’re an experienced Standard Library user or you just need to jog your memory, this short paragraph or two will satisfy you. Following the bare-bones answer is a detailed solution. This is useful if you’ve never used the tip’s technique or if the short solution is just too concise. The detailed answer has a complete C++ program that illustrates the method in the tip. The text discusses the code and gives a thorough explanation of its key points. A few of the programs may seem longer than what is necessary solely to demonstrate a technique. I’ve done this on purpose, though. One of the things that bothers me about many technical books is that the examples are too simplistic to be of much help. Because object-oriented programming is so important to C++, quite a few of the programs use classes, and this causes the code to be longer. However, I find this makes the examples more realistic, helpful, and valuable. Deciding between brevity and practicality is subjective, however, and someone is certainly bound to be disappointed by my choice. Nonetheless, you don’t have to worry about having to slog through endless pages of pontification—the programs are only about a page or two long, and the explanations just slightly longer. You can quickly get a good understanding of your problem’s solution and then get back to the fun stuff—writing code. If you’d like to explore a tip in more detail, you have several options. First, each tip has references to other relevant tips. These tips may contain alternate techniques, related methods, or supplementary material. Second, the tips are grouped according to topic. Thus, for example, if you’re about to start working with vectors and would like some background first, you can leaf through Chapter 4, “Tips on Vectors.” It will give you some tips on the power and pitfalls of this container. Third, Chapter 13 has an application that uses some of the tips in a realistic setting. If the technique you’re interested in is in this chapter, you get to see it in action. Finally, Chapters 1 and 2 contain an overview and review of the Standard Library and its main component, the Standard Template Library. This information helps you see how the tip fits into the general scheme of things and serves as a good review of some basic Standard Library concepts.
【文件预览】:
c++_standard_library_practical_tips.chm