The C ++ standard library is very large. Incredible big. How can this problem be solved? In the C ++ standard, the specification descriptions of the standard library account for more than 300 pages. This does not include the standard C library, the latter is only included in the C ++ library as a reference. Of course, the larger the standard library, the better, but in the current situation, the better, because a large library contains a large number of functions. The more features the standard library has, the more applications you can develop.ProgramThe more features you can use. The C ++ library does not provide everything (obviously, it does not provide support for concurrency and graphical user interfaces), but does provide a lot. You can turn to it for almost everything.
Before summarizing what is in the standard library, we need to explain how it is organized. Because there are so many things in the standard library, the class name or function name you (User) Select may be the same as a name in the standard library. To avoid name conflicts, everything in the standard library is put in the namespace STD. But this brings about a new problem. Countless existing C ++CodeAll rely on features in the pseudo-standard library that have been used for many years, such as declarations in header files such as <iostream. h>, <complex. h>, and <limits. h>. Existing software is not designed to use namespace. It would be shameful to use STD to wrap the standard library and render existing code unusable. (This base-paid approach will make it harder for programmers with existing code to say something worse than "Shame".) It will be a deterrent to the destructive power of angry programmers, the Standards Board decided to create a new header file name for the standard library component that wraps STD. The method to generate a new header file is to remove. h from the existing C ++ header file name. Therefore, <iostream. h> is changed to <iostream>, <complex. h> is changed to <complex>, and so on. Use the same method for the c header file, but add a C before each name. Therefore, <string. h> of C is changed to <cstring>, <stdio. h> is changed to <cstdio>, and so on.
the last point is that the old c ++ header file is officially opposed (that is, it is explicitly listed as not supported ), but the old c header file does not (to maintain compatibility with C ). In fact, the compiler manufacturer will not stop providing support for the customer's existing software, so it is expected that the old c ++ header file will still be supported in the next few years. Therefore, the current situation of the C ++ header file is as follows: the old c ++ header file names, such as , will continue to be supported, even though they are not in the official standard. The contents of these header files are not in the namespace STD. The new C ++ header file contains the same basic functions as the corresponding old header file, but the header file content is in the namespace STD. (Some details of the library are modified during the standardization process, so the old header file and the object in the new header file do not necessarily correspond completely .) The standard C header file is supported, as shown in . The header file is not in STD. The new C ++ header file with the C library function has a name such as . They provide the same content as the corresponding old c header file, but the content is in STD. It seems strange at first, but it is not hard to get used to it. The biggest challenge is to clarify the string header file: it is the old c header file, corresponding to the string processing function based on char *; it is the c ++ header file packaging STD, corresponding to the new string class (see below); is the STD Version corresponding to the old c header file. If you can grasp this (I believe you can), the rest will be easy.