The Microsoft C++ Standard Library — commonly called the STL — is a rich collection of class templates, functions, and objects declared across more than 100 standard headers. It covers everything from type-safe containers and generic algorithms to I/O streams, concurrency primitives, and compile-time utilities. Microsoft’s implementation ships with Visual Studio and satisfies both the hosted and freestanding requirements of the ISO C++ standard.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MicrosoftDocs/cpp-docs/llms.txt
Use this file to discover all available pages before exploring further.
Hosted vs. Freestanding Implementations
The C++ standard defines two conformance tiers:- A hosted implementation supports every required standard header. MSVC satisfies this tier for ordinary application and library development.
- A freestanding implementation requires only a minimal subset of headers, suitable for kernels, firmware, or embedded targets without an OS.
| Header | Header | Header |
|---|---|---|
<atomic> | <functional> | <ranges> |
<bit> | <initializer_list> | <ratio> |
<cfloat> | <iterator> | <tuple> |
<climits> | <limits> | <type_traits> |
<compare> | <memory> | <typeinfo> |
<concepts> | <new> | <utility> |
<coroutine> | <source_location> | <version> |
<cstdarg> | <cstddef> | <exception> |
<cstdint> | <cstdlib> |
C++ Standard Conformance
MSVC’s STL implementation tracks the ISO C++ standard closely:C++17
std::optional, std::variant, std::string_view, parallel algorithms, std::filesystem, structured bindings, and if constexpr.C++20
std::format, std::jthread, std::span, std::bit_cast, calendar/timezone in <chrono>, and more.C++23
std::expected, std::flat_map, std::mdspan, std::print, std::generator, and further ranges improvements./std:c++17, /std:c++20, or /std:c++latest compiler flag.
Including Headers
Every C++ Standard Library entity is declared in one or more standard headers. Simply#include the header that defines what you need — no linking step is required for the STL itself when using the MSVC toolchain.
Header Categories
The Standard Library headers fall into several broad categories:Containers — <vector>, <map>, <set>, <deque>, <list>, …
Containers — <vector>, <map>, <set>, <deque>, <list>, …
vector, deque, list, array, forward_list), ordered associative containers (map, set, multimap, multiset), and unordered hash-based containers (unordered_map, unordered_set). See Containers.Algorithms — <algorithm>, <numeric>
Algorithms — <algorithm>, <numeric>
std::sort, std::stable_sort), searching (std::find, std::binary_search), transforming (std::transform, std::for_each), and numeric operations (std::accumulate, std::reduce). C++20 adds the Ranges library. See Algorithms.Strings & I/O — <string>, <string_view>, <iostream>, <fstream>, <sstream>, <format>
Strings & I/O — <string>, <string_view>, <iostream>, <fstream>, <sstream>, <format>
std::string, std::wstring, std::string_view), console I/O (cin, cout, cerr), file streams, string streams, and type-safe formatting with std::format (C++20). See Strings and I/O.Concurrency — <thread>, <mutex>, <condition_variable>, <future>, <atomic>
Concurrency — <thread>, <mutex>, <condition_variable>, <future>, <atomic>
std::thread and std::jthread (C++20), mutual exclusion with std::mutex and RAII guards, synchronization with std::condition_variable, asynchronous tasks with std::async and std::future, and lock-free programming with std::atomic. See Concurrency.Iterators — <iterator>
Iterators — <iterator>
for loops use iterators transparently.Numerics — <numeric>, <cmath>, <complex>, <valarray>, <random>
Numerics — <numeric>, <cmath>, <complex>, <valarray>, <random>
Utilities — <utility>, <tuple>, <optional>, <variant>, <any>, <functional>, <memory>
Utilities — <utility>, <tuple>, <optional>, <variant>, <any>, <functional>, <memory>
std::variant), nullable values (std::optional), type-erased storage (std::any), function wrappers (std::function), and smart pointers (unique_ptr, shared_ptr, weak_ptr).Diagnostics & Exceptions — <exception>, <stdexcept>, <system_error>
Diagnostics & Exceptions — <exception>, <stdexcept>, <system_error>
std::out_of_range, std::invalid_argument), and std::error_code / std::error_condition for portable system error reporting.Thread Safety
Individual objects in the C++ Standard Library are not thread-safe for simultaneous write access. Multiple concurrent reads on the same object are generally safe. When sharing objects across threads always use appropriate synchronization (std::mutex, std::atomic, etc.).
The <iostream> global objects (cout, cin, cerr) are thread-safe at the level of individual stream insertions and extractions, but interleaving of output from multiple threads is not ordered unless you serialize externally.