Simplified STL Chinese Version"Translation
Just like the first two sister books in this book (semantic C ++, more than tivec ++), the focus of this book is to improve the reader's experience, this time, I only focused on the C ++ standard library, and it is one of the most interesting parts-STL.
C ++ is a programming language that is easy to learn and difficult to use. From learning to using C ++ well, it must be continuously practiced. Scott Meyers
These three sisters' works help you shorten the process from different perspectives. After nearly two decades of development, the C ++ language has gradually improved. Even so, when using C ++, there are still many traps, some of which are very obvious and can be understood as soon as you click it. Some traps are not so straightforward, careful analysis is required to unveil the layer of mystery.
This book is intended for STL
Summary of the experience, the book lists 50 terms, the vast majority of terms are explained in the use of STL should pay attention to a certain aspect of the problem, the problem sources and solutions are analyzed in detail. This is the experience that the author has summed up in teaching and practice. The content is worth learning and thinking.
The source code of STL is not large, but it contains profound ideas. In the process of C ++ standardization, STL
It is also fixed and unified. Each STL implementation is divided into two parts: STL.
This is the basis for applications to deal with, and is also known as STL; second, STL
Implementation, especially some internal mechanisms, some of which are defined by the C ++ standard, but some are self-selected by the implementers. In the field of software design, there is a general rule that separates interfaces from implementations. But for STL, you cannot simply use this rule. Although the program code you write is only related to STL
But to use STL, You need to fully understand STL.
Based on the implementation. Not only do you need to understand the knowledge that all STL implementations are common, but you also need to understand the STL
Special knowledge of implementation. So how do you grasp the relationship between interfaces and implementations? This book describes many STL related to both interfaces and implementations.
By explaining these usage, the reader can better understand how to view these implementation-related knowledge.
Over the past two years
More and more books, and many c ++ books have begun to pay more attention to STL.
This part of content. This is undoubtedly a good thing for readers, because STL
The difficult problem is finally solved. We can see that, for example, vector and string
And other commonly used STL components appear in almost any c ++ program. However, the problem of STL's hard-to-use has been exposed, and programmers want to make full use of STL.
Is not easy. In existing STL books, this book guides readers to make good use of STL.
Is rare.
This book follows the author's consistent writing style and uses STL in the form of clauses
Is organized together, the book mainly includes the following content:
How to select the container type. STL
There are not many types of containers in, but different containers have different characteristics. Therefore, choosing the appropriate container type is often the starting point to solve the problem. This book also introduces
Notes related to the string container.
There are more traps involved in associated containers, and they may fall into the trap as soon as they are left empty. The author points out some inintuitive points in the associated containers, and also introduces a non-standard associated container-Hash container.
The iterator is STL.
Is also an important way for programmers to access containers. This book discusses with const_iterator
Some issues related to reverse_iterator. In my personal opinion, this Part of this book is a little thin, after all, the iterator in STL
Is a key component.
STL
An algorithm is a place where STL functions are embodied. A simple algorithm call may accomplish a very complex task, but STL must be used properly.
Many algorithms are not easy. This book provides some important inspiration.
The function object is STL.
One of the key weapons used, it makes every algorithm in STL highly scalable. This book also discusses some key points related to functions and function objects.
Other aspects include how to differentiate algorithms and member functions with the same name, how to consider program efficiency, how to maintain program readability, how to interpret debugging information, and how to consider portability issues.
This book does not cover all the things that need to be paid attention to. Instead, it selects some representative questions and examples that are the most universally applicable. Some problems do not have a perfect solution, but the author has already analyzed the problem for you. Therefore, the final solution depends on you as a practitioner.
I have completed the translation of this book in cooperation with Chen Ming and Yan kaihong. Among them, Yi kaihong has completed the first 25
Chen Ming completed the last 25 original translations, and finally completed the final work of all content. At the same time, I also revised according to the original author's errata. Errors are inevitable. Please forgive me.
For each expected STL
This book is worth reading.
Pan aimin
This article is excerpted from the Chinese version of objective STL.
Pan aimin, Chen Ming, Kai Hong
By
Published by Electronic Industry Publishing House