Muokkaa

Jaa


C++ Standard Library (STL) overview

All C++ library entities are declared or defined in one or more standard headers. This implementation includes two other headers, <hash_map> and <hash_set>, that aren't required by the C++ Standard. For a complete list of headers that this implementation supports, see Header files reference.

The C++ standard defines two kinds of conforming libraries:

  • A hosted implementation, which supports all of the required standard library headers described by the C++ ISO standard.
  • A freestanding implementation, which requires only a subset of the standard library headers. The required subset is:
Freestanding header subset
<atomic> (declaring at least atomic_signed_lock_free and atomic_unsigned_lock_free) <cstdint> <ranges>
<bit> <cstdlib> (declaring at least abort, atexit, at_quick_exit, exit, quick_exit) <ratio>
<cfloat> <exception> <tuple>
<climits> <functional> <typeinfo>
<compare> <initializer_list> <source_location>
<concepts> <iterator> <type_traits>
<coroutine> <limits> <utility>
<cstdarg> <memory> <version>
<cstddef> <new>

The following headers are deprecated since C++11: <ciso646>, <cstdalign>, and <cstdbool>.

Other differences between freestanding and hosted implementations are:

  • Hosted implementations require a global function named main. A freestanding implementation can define its own startup and termination functions.
  • Hosted implementations must support more than one thread running at the same time. Implementors of freestanding implementations decide whether their library supports concurrent threads.

The Microsoft C++ standard library satisfies both freestanding and hosted requirements.

The C++ library headers have two broader subdivisions:

This section contains the following sections:

For more information about Visual C++ run-time libraries, see CRT Library Features.

Note

Microsoft's implementation of the C++ Standard Library is often referred to as the STL or Standard Template Library. Although C++ Standard Library is the official name of the library as defined in ISO 14882, due to the popular use of "STL" and "Standard Template Library" in search engines, we occasionally use those names to make it easier to find our documentation. From a historical perspective, "STL" originally referred to the Standard Template Library written by Alexander Stepanov. Parts of that library were standardized in the C++ Standard Library, along with the ISO C runtime library, parts of the Boost library, and other functionality. Sometimes "STL" is also used to refer to the containers and algorithms parts of the C++ Standard Library adapted from Stepanov's STL. In this documentation, Standard Template Library (STL) refers to the C++ Standard Library as a whole.

See also

C++ Standard Library