C++ Standard Library
C++ Standard Library
C++ standard headers, major facilities, and the main types, algorithms, and utilities you will look up repeatedly.
C++ Standard Library
C++ standard headers, major facilities, and the main types, algorithms, and utilities you will look up repeatedly.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
The C++ standard library is too large to present every overload, member function, customization point, and trait specialization on one page without turning the page into noise. This page is now a hub that points to the main library families and the dedicated header index.
<utility>, <type_traits>, <typeinfo>, <compare>, <concepts>std::move, std::forward, std::swap, std::pairstd::is_same_v, std::remove_cvref_t, std::is_invocable_vstd::type_infostd::strong_orderingstd::integral, std::regular, std::predicate<tuple>, <optional>, <variant>, <any>, <expected>std::tuple, std::tie, std::get, std::applystd::optionalstd::variant, std::visitstd::anystd::expected, std::unexpected<functional>std::function, std::invoke, std::reference_wrapper, binders, arithmetic/comparison functors<string>, <string_view>, <charconv>, <format>, <print>std::basic_string, std::string, std::wstringstd::basic_string_view, std::string_viewstd::from_chars, std::to_charsstd::format, std::vformat, formattersstd::print, std::println<regex> and <locale>std::regex, std::smatch, regex algorithmsFor a more focused algorithms and lazy-pipeline reference, see C++ algorithms and ranges.
<iterator> and <ranges>std::ranges algorithmsfilter, transform, take, drop, split, keys, values<algorithm> and <numeric>std::accumulate, std::reduce, std::transform_reduce, scans, gcd/lcmFor a denser container-by-container summary, see C++ containers and views.
<array>: std::array<vector>: std::vector<deque>: std::deque<list>: std::list<forward_list>: std::forward_list<map>: std::map, std::multimap<set>: std::set, std::multiset<unordered_map>: std::unordered_map, std::unordered_multimap<unordered_set>: std::unordered_set, std::unordered_multiset<stack>: std::stack<queue>: std::queue, std::priority_queue<span>: std::span<mdspan>: std::mdspan<memory> and friendsstd::unique_ptr, std::shared_ptr, std::weak_ptrstd::addressof, std::to_address<new>std::bad_alloc<iostream>, <istream>, <ostream>, <fstream>, <sstream>std::cin, std::cout, std::cerr<filesystem>std::filesystem::pathFor time, random, and math facilities grouped together, see C++ numerics and time.
<chrono>time_point, calendars, time zones<random>std::mt19937std::uniform_int_distribution, std::normal_distribution<numbers>, <ratio>, <complex>, <valarray>, <cmath>For threads, atomics, futures, semaphores, latches, and barriers on one page, see C++ concurrency library.
<thread>, <mutex>, <shared_mutex>, <condition_variable>std::thread, std::jthread, std::stop_tokenstd::mutex, std::recursive_mutex, std::timed_mutexstd::shared_mutex, std::shared_lockstd::condition_variable, std::condition_variable_any<future>, <atomic>, <semaphore>, <barrier>, <latch>std::future, std::promise, std::async, std::packaged_task<exception>, <stdexcept>, <system_error>, <source_location>std::runtime_error, std::invalid_argument, std::out_of_rangestd::error_code, std::error_category, std::system_errorstd::source_locationMany C headers are available in c-prefixed form with names in namespace std, including:
<cassert>, <cctype>, <cerrno>, <cfenv>, <cfloat>, <cinttypes>, <climits><cmath>, <csetjmp>, <csignal>, <cstdarg>, <cstddef>, <cstdint>, <cstdio>, <cstdlib><cstring>, <ctime>, <cuchar>, <cwchar>, <cwctype>#include <vector>
#include <algorithm>
int main() {
std::vector<int> values{4, 1, 3, 2};
std::sort(values.begin(), values.end());
}