Http://blog.csdn.net/ruglcc/article/details/7921081
1. What is the C & C ++ standard library?
When C language was invented, there were no library functions. With the popularity of C language, more and more vendors or organizations began to provide C compilers, at the same time, the commonly used functions are encapsulated into "databases" for release. The interfaces and quantities of library functions released by different organizations are different. Later, the Standardization Organization ANSI developed the C language standard and a certain number of libraries (or library functions), which became the standard library function. (This ansi c standard was later upgraded to the ISO standard, but the content has not changed! Who makes America the boss, and C's source region is the United States ).
C does not have the object-oriented feature. c ++ is generated after the C language is expanded. Of course, standard organizations like ISO should also set standards for it, as a result, the C ++ standard library emerged on the basis of the C language.
Note the following two points:
1. The C ++ standard library not only inherits the C standard library, but also expands many library functions. (The C standard library corresponds to more than a dozen header files, and the C ++ library contains more than 50 header files .)
2. the header file of the C language library can be directly applied to the C ++ SourceProgram(For example, use # include <math. h>). However, the new C ++ standard draft this year (basically the final version, ah, wait for a long time) does not use the above method, instead, use the new C ++ method, that is, # include <cmath>; that is, "add the header to the end ".
2. What are the c Standard libraries?
They correspond to some header files respectively:
[CPP] View plaincopy
- Assert. h;
- Ctype. h;
- Error. h;
- Float. H;
- Limits. h;
- Locate. h;
- Math. h;
- Setjmp. h;
- Signal. h;
- Stdarg. h;
- Stddef. h;
- Stdio. h;
- Stdlib. h;
- String. h;
- Time. h
A total of fifteen head files.
3. What are the C ++ standard libraries?
All header files in the C ++ standard library do not have an extension (# include <cmath>). You can also use name in C ++. the file name of the Standard C library header in the form of H (this is not recommended. This year'sNew Standard!!!)
The content of the C ++ standard library is defined in a total of 50 standard header files, 18 of which provide the function of the C library. <Cname> standard header file [<complex> exception] contains the same content as the name. h header file in ISO Standard C, but supports the C ++ Extension function. In the header file of the <cname> standard format, the names related to the macro are defined in the global scope, and other names are declared in the STD namespace.
The content of the C ++ standard library is divided into 10 categories:
1. Language Support 2. Input/Output 3. diagnosis 4. General tool 5. String
6. Container 7. Support for iterator 8.Algorithm9. Numeric operations 10. Localization
1. header files related to the language support function in the standard library
<Cstddef> define macro null and offsetof, and other standard types of size_t and ptrdiff_t. The difference with the corresponding standard C header file is that null is a complementary definition of the NULL pointer constant in C ++, and the macro offsetof accepts the structure or joint type parameters, as long as they do not have non-static members of the member pointer type.
<Limits> defines basic data types. For example, for each numeric data type, it defines the maximum and minimum values that can be expressed and the number of digits of the binary number.
<Climits> provides the C style definition related to the basic integer data type. The C ++ style of the information is defined in <limits>
<Cfloat> provides C style definitions related to basic floating point data types. The C ++ style of the information is defined in <limits>
<Cstdlib> provides macros and functions that support program startup and termination. This header file also declares many other miscellaneous functions, such as search and sorting functions, from string to numeric functions. Unlike the corresponding standard C header file stdlib. H, it defines abort (void ). The abort () function also has additional functions. It neither calls the Destructor for static or automatic objects, nor calls the function that is passed to the atexit () function. It also defines additional functions of the exit () function, which can release static objects and call the functions registered with atexit () in reverse order. Clear and close all open C streams and return control to the host environment.
<New> support for dynamic memory allocation
<Typeinfo> supports the type identification of variables during running
<Exception> exception handling is supported. This is a possible error in the processing program.
<Cstdarg> supports functions that accept variable parameters. That is, when you call a function, you can send data items of a different number to the function. It defines the macro va_arg, va_end, va_start, and va_list types.
<Csetjmp> provides functions for C-style non-local jumps. These functions are not commonly used in C ++.
<Csignal> provides C style support for interrupt handling
2. Supports Stream Input/Output header files
<Iostream> supports the input and output of standard streams Cin, cout, cerr, and clog. It also supports multi-byte standard streams wcin, wcout, wcerr, and wclog.
<Iomanip> provides a control program that allows you to change the stream status and output format.
<IOS> define the base class of iostream
<Istream> defines a template class for the input in the output stream cache area.
<Ostream> defines a template class for the output of the output stream cache area.
<Sstream> supports Stream Input and Output of strings
<Fstream> supports Stream Input and Output of files.
<Iosfwd> Provide Forward Declaration for input and output objects
<Streambuf> supports stream input and output caching.
<Cstdio> provides C-style input and output for standard streams
<Cwchar> supports multi-byte C-style Input and Output
3. header files related to diagnostic functions
<Stdexcept> A standard exception is defined. Exception is the way to handle errors
<Cassert> defines an assertion macro to check conditions during running.
<Cerrno> supports C-style error messages.
4. Define the header file of the tool function
<Utility> defines overloaded Relational operators to simplify the writing of Relational operators. It also defines the pair type, which is a template type and can store a pair of values. These functions are used elsewhere in the library
<Functional> defines many function object types and functions that support function objects. Function objects are arbitrary objects that support operator () function call operators.
<Memory> define a standard memory distributor for the container, memory management function, and auto_ptr template class
<Ctime> supports system clock functions
5. header files that support string processing
<String> supports and defines string types, including single-byte strings (consisting of char) and Multi-byte strings (consisting of wchar_t)
<Cctype> single-byte character type
<Cwctype> multi-Byte Character Type
<Cstring> provides functions for processing non-empty byte sequences and memory blocks. This is different from the corresponding standard C library header file. The C library functions of several C-style strings are returned as const and non-
The const function pair is replaced
<Cwchar> provides functions for processing, executing I/O, and converting multi-byte character sequences, which is different from the corresponding standard C-library header file, several multi-byte C-style string operations
The return value is replaced by the const and non-const function pairs.
<Cstdlib> provides a function to convert a single-byte string to a numeric value and between multi-byte characters and multi-byte strings.
6. Define the header file of the container class template
<Vector> defines the vector sequence template, which is an array type that can be reset by size, which is safer and more flexible than normal arrays.
<List> defines a list sequence template, which is a sequence linked list. elements are often inserted and deleted at any location.
<Deque> defines the deque sequence template and supports efficient insertion and deletion at the beginning and end.
<Queue> defines the sequence adapter queue and priority_queue for the queue (first-in-first-out) Data Structure
<Stack> defines a sequence adapter stack for the data structure of the stack (before, before, after, and after ).
<Map> map is an associated container type. It can be stored in ascending order according to the key value. Multimap is similar to map, but the key is not unique.
<Set> set is an associated container type used to store unique values in ascending order. Multiset is similar to set, but the value does not have to be unique.
<Bitset> defines a bitset template for a bit sequence with a fixed length. It can be seen as a fixed-length, compact bool array.
7. Support for iterator header files
<Iterator> defines and supports the iterator.
8. header files related to Algorithms
<Algorithm> provides a set of algorithm-based functions, including replacement, sorting, merging, and search.
<Cstdlib> declare the C standard library functions bsearch () and qsort () for search and sorting.
<Ciso646> allowCodeUse and to replace &&
9. header files related to numeric operations
<Complex> supports the definition and operation of complex values.
<Valarray> supports numeric vector operations.
<Numeric> defines a set of general mathematical operations on a numerical sequence, such as accumulate and inner_product.
<Cmath> This is the C math library, which also attaches heavy-load functions to support the C ++ conventions.
<Cstdlib> the function can extract the absolute value of an integer and perform the remainder operation on the integer.
10. localized header files
<Locale> localized features include the character category, sorting sequence, and currency and date representation.
<Clocale> C style support for localization