Online Book Reader

Home Category

Professional C__ - Marc Gregoire [512]

By Root 1404 0

The C++ Standard Library includes the entire C Standard Library. The header files are generally the same, except for two points:

The header names are instead of .

All the names declared in the header files are in the std namespace.

For backward compatibility, you can still include if you want. However, that puts the names into the global namespace instead of the std namespace. We recommend avoiding this feature.

The following table provides a summary of the most useful functionality:

HEADER FILE NAME CONTENTS

assert() macro.

Utilities to work with complex numbers.

Character predicates and manipulation functions, such as isspace() and tolower().

Defines errno expression.

Supports the floating-point environment, such as floating-point exceptions, rounding, and so on.

C-style defines related to floating-point arithmetic, such as FLT_MAX.

Defines a number of macros to use with the printf(), scanf() and similar functions. Also includes a few functions to work with intmax_t.

In C, the file defines macros and, or, etc. In C++, those are keywords, so they are not in this header.

C-style limit defines, such as INT_MAX.

A few localization macros and functions like LC_ALL and setlocale().

Math utilities, including trigonometric functions, sqrt(), fabs(), and others.

setjmp() and longjmp(). Never use these in C++!

signal() and raise(). Avoid these in C++.

Alignment related macro __alignas_is_defined.

Macros and types for processing variable-length argument lists.

Boolean type related macro __bool_true_false_are_defined.

Important constants such as NULL, and important types such as size_t.

Defines a number of standard integer types such as int8_t, int64_t and so on. It also includes macros specifying minimum and maximum values of those types.

File operations, including fopen() and fclose(). Formatted I/O: printf(), scanf(), and family. Character I/O: getc(), putc(), and family. File positioning: fseek(), ftell().

Random numbers with rand() and srand(). The abort() and exit() functions, which you should avoid. C-style memory allocation functions: calloc(), malloc(), realloc(), free(). C-style searching and sorting with qsort() and bsearch(). String to number conversions: atof(), atoi(), etc.

Low-level memory management functions, including memcpy() and memset(). C-style string functions, such as strcpy() and strcmp(). Secure versions such as strcpy_s(). Defines NULL and size_t as well.

Just includes and .

Time-related functions, including time() and localtime().

Defines a number of Unicode-related macros, and functions like mbrtoc16().

Versions of string, memory, and I/O functions for wide characters.

Versions of functions in for wide characters: iswspace(), towlower(), and so on.

CONTAINERS

The definitions for the STL containers can be found in 12 header files:

HEADER FILE NAME CONTENTS

The array class template.

The bitset class template.

The deque class template.

The forward_list class template.

The list class template.

The map and multimap class templates.

The queue and priority_queue class templates.

The set and multiset class templates.

The stack class template.

The unordered_map and unordered_multimap class templates.

The unordered_set and unordered_multiset class templates.

The vector class template and the vector specialization.

Each of these header files contains all the definitions you need to use the specified container, including iterators. Chapter 12 describes these containers in detail.

ALGORITHMS, ITERATORS, AND ALLOCATORS

The “rest” of the STL can be found in five different header files:

HEADER FILE NAME CONTENTS

Prototypes

Return Main Page Previous Page Next Page

®Online Book Reader