{
 "id": "ep2gtn4f1q",
 "slug": "c-standard-library-ep2gtn4f1q",
 "title": "C++ Standard Library",
 "updated": "2026-10-15",
 "topic_path": [
  {
   "id": "technology",
   "label": "Technology and the built world",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology"
  },
  {
   "id": "technology.computing",
   "label": "Computing and digital systems",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing"
  },
  {
   "id": "technology.computing.software",
   "label": "Software and programming",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.software"
  },
  {
   "id": "technology.computing.software.development_tools_infrastructure",
   "label": "Development tools and collaboration infrastructure",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.software.development_tools_infrastructure"
  },
  {
   "id": "technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis",
   "label": "Frameworks, libraries, and APIs",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis"
  },
  {
   "id": "technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis.mobile-and-platform-frameworks",
   "label": "Mobile and platform frameworks",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis.mobile-and-platform-frameworks"
  }
 ],
 "geo": [
  {
   "id": "geo.us.t1946.technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis",
   "label": "United States · 1946 to 2000: Frameworks, libraries, and APIs",
   "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946.technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis",
   "path": [
    {
     "id": "geo.us",
     "label": "United States",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us"
    },
    {
     "id": "geo.us.t1946",
     "label": "United States · 1946 to 2000",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946"
    },
    {
     "id": "geo.us.t1946.technology",
     "label": "Technology and the built world",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946.technology"
    },
    {
     "id": "geo.us.t1946.technology.computing",
     "label": "Computing and digital systems",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946.technology.computing"
    },
    {
     "id": "geo.us.t1946.technology.computing.software",
     "label": "Software and programming",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946.technology.computing.software"
    },
    {
     "id": "geo.us.t1946.technology.computing.software.development_tools_infrastructure",
     "label": "Development tools and collaboration infrastructure",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946.technology.computing.software.development_tools_infrastructure"
    },
    {
     "id": "geo.us.t1946.technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis",
     "label": "Frameworks, libraries, and APIs",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.us.t1946.technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis"
    }
   ]
  }
 ],
 "excerpt": "The C++ Standard Library is the set of headers and components defined in the ISO C++ standard, supplying containers, algorithms, strings, numerics, and concurrency, mostly in namespace std.",
 "snippet": "The C++ Standard Library is the set of headers and components defined in the ISO C++ standard, supplying containers, algorithms, strings, numerics, and concurrency, mostly in namespace std.",
 "node": "technology.computing.software.development_tools_infrastructure.frameworks-libraries-and-apis.mobile-and-platform-frameworks",
 "markdown": "# C++ Standard Library\n\nThe C++ Standard Library is the set of headers, components, and behavioral guarantees specified in the ISO C++ standard ([ISO/IEC 14882](https://www.edgepedia.org/iso-iec-14882)). It supplies containers, iterators, ranges, algorithms, strings, numerics, input/output, diagnostics, memory management, utilities, and concurrency support, almost all of it declared in the namespace `std`.<sup>[1](https://eel.is/c++draft/library)</sup><sup> • </sup><sup>[2](https://cppreference.com/cpp/standard_library)</sup> The library is not a separate document: it is defined inside the language standard itself, and it constitutes about three quarters of the C++20 standard's text.<sup>[3](https://stroustrup.com/hopl20main-p5-p-bfc9cd4--final.pdf)</sup>\n\n| Key fact | Detail |\n|---|---|\n| Defining document | ISO/IEC 14882; the standard library is about 3/4 of the C++20 standard<sup>[3](https://stroustrup.com/hopl20main-p5-p-bfc9cd4--final.pdf)</sup> |\n| Namespace | All library entities except `operator new` and `operator delete` live in `std` or namespaces nested within it<sup>[2](https://cppreference.com/cpp/standard_library)</sup> |\n| Implementation kinds | Hosted implementations provide all required headers; freestanding implementations provide an implementation-defined subset<sup>[1](https://eel.is/c++draft/library)</sup> |\n| Major implementations | libstdc++ (GPL v3 + runtime exception), libc++ (Apache 2.0 + LLVM exception), MSVC STL (Apache 2.0 + LLVM exception)<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup><sup> • </sup><sup>[5](https://learn.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-overview?view=msvc-170)</sup> |\n| Reach | libc++ is the default library on macOS, iOS, watchOS, tvOS, Android, and FreeBSD, with an estimated user base of over 1 billion daily active users<sup>[6](https://libcxx.llvm.org/)</sup> |\n| Adoption (2024 survey) | 90.81% of respondents use C++11 features \"pretty much\"; 20.02% report full use of C++23 features such as `expected` and `md_span`<sup>[7](https://isocpp.org/files/papers/CppDevSurvey-2024-summary.pdf)</sup> |\n| Compile cost | Including the whole C++23 library expands to 128,846 lines under GCC (1,175 ms net compile time) and 87,186 lines under Clang (1,598 ms)<sup>[8](https://github.com/whatchamacallem/cxx-std-include-bench/)</sup> |\n| Safety direction | C++26 standard library hardening adds runtime-checked hardened preconditions against out-of-bounds access in containers, `span`, `mdspan`, `string`, and `string_view`<sup>[9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3471r1.html)</sup> |\n\n## Structure and components\n\nEach element of the library is declared or defined in a header, and the set of headers grows with every revision of the standard.<sup>[10](https://eel.is/c++draft/headers)</sup> C++11 added `<condition_variable>`, `<forward_list>`, `<unordered_map>`, `<type_traits>`, and others; C++17 added `<memory_resource>` and `<string_view>`; C++20 added `<stop_token>` and `<source_location>`; C++23 added `<flat_map>` and `<flat_set>`; C++26 adds `<hazard_pointer>`, `<inplace_vector>`, and `<text_encoding>`.<sup>[2](https://cppreference.com/cpp/standard_library)</sup> [Regular expression](https://www.edgepedia.org/regular-expression) matching arrived with C++11, text formatting with C++20, and text encoding identification with C++26.<sup>[2](https://cppreference.com/cpp/standard_library)</sup>\n\nThe library is organized into named sub-libraries: language support, diagnostics, memory management, general utilities, the containers/iterators/ranges/algorithms group, strings, text processing, numerics, and execution support.<sup>[2](https://cppreference.com/cpp/standard_library)</sup> An empirical study of library use counts 11 sub-libraries, 8 established before C++11 (Containers, Iterators, Algorithms, Utilities, Strings, Numerics, Input/Output, Localizations) plus 3 added by C++11 (Regular Expressions, Atomic Operations, Thread Support).<sup>[11](https://ksiresearch.org/seke/seke15paper/seke15paper_9.pdf)</sup> The containers, iterators, ranges, and algorithms clauses are described by the standard itself as providing access to a subset of the most widely used algorithms and data structures.<sup>[1](https://eel.is/c++draft/library)</sup>\n\nSince C++23, a named module `std` exports the declarations in namespace `std` provided by the importable library headers, offering an alternative to textual `#include`.<sup>[2](https://cppreference.com/cpp/standard_library)</sup>\n\n## Design and extension mechanisms\n\nThe library's original extension point is the allocator. Alexander Stepanov's Standard Template Library addressed portability across memory models by providing a standard set of requirements for allocators, objects that encapsulate memory-model information, and all STL containers are parameterized in terms of allocators; this design carried into the standardized library.<sup>[12](https://www.stepanovpapers.com/STL/DOC.PDF)</sup>\n\n## Guarantees: complexity, exceptions, and safety\n\nThe standard distinguishes hosted and freestanding implementations. A hosted implementation supports all of the required standard library headers; a freestanding implementation has an implementation-defined set of headers.<sup>[1](https://eel.is/c++draft/library)</sup><sup> • </sup><sup>[5](https://learn.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-overview?view=msvc-170)</sup>\n\nIn a non-hardened implementation, container accessors such as `vector::operator[]` do not range-check; out-of-range access is undefined behavior. C++26 addresses this through standard library hardening. The hardening proposal focuses on hardened preconditions that prevent out-of-bounds memory access, targeting accessors of sequence containers, `std::span`, `std::mdspan`, `std::string`, `std::string_view`, modifiers like `pop_back`, and accessors of `optional` and `expected`.<sup>[9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3471r1.html)</sup> In a hardened implementation, hardened preconditions are checked at runtime and a violation is a contract assertion with terminating semantics, evaluated before any other observable side effect of the function; these checks cannot be bypassed with the `ignore` contract semantic.<sup>[2](https://cppreference.com/cpp/standard_library)</sup><sup> • </sup><sup>[9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3471r1.html)</sup> Hardening is designed to avoid ABI (application Binary Interface: compiled code's binary-level compatibility contract) changes and for production use, and the mechanism to request it is implementation-defined, for example a compiler flag like `-fhardened` or a macro such as `-D_LIBCPP_HARDENING_MODE=`.<sup>[9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3471r1.html)</sup>\n\n## Implementations\n\nThree implementations dominate. libstdc++ ships with GCC under the GPL v3 with a runtime exception; libc++ ships with Clang under Apache 2.0 with the LLVM exception; Microsoft's MSVC STL is released under the [Apache License](https://www.edgepedia.org/apache-license) 2.0 with LLVM Exceptions.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup><sup> • </sup><sup>[5](https://learn.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-overview?view=msvc-170)</sup> Microsoft's distribution additionally includes `<hash_map>` and `<hash_set>`, headers not required by the C++ Standard.<sup>[5](https://learn.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-overview?view=msvc-170)</sup>\n\n**ABI and layout differ in visible ways.** libstdc++ supports a dual ABI selected by `_GLIBCXX_USE_CXX11_ABI`; libc++ versions its symbols through the `__1` inline namespace; MSVC STL aligns its ABI with [Visual Studio](https://www.edgepedia.org/visual-studio) versions. Debug modes that add checking (`_GLIBCXX_DEBUG`, `_ITERATOR_DEBUG_LEVEL`) break ABI, while `_LIBCPP_HARDENING_MODE` does not.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup> Small-string optimization also differs: libc++ uses a 22-byte SSO buffer for `std::string` on 64-bit platforms versus 15 bytes in libstdc++ and MSVC STL, giving `sizeof(std::string)` of 24 bytes versus 32 bytes.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup>\n\n**Completeness varies by feature.** As of LLVM 18, libc++ shipped no parallel algorithms, while libstdc++ did; MSVC STL also lacked them.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup> libc++ fully implements C++11 and C++14, with C++17, C++20, C++23, C++26, and C++29 support marked in progress.<sup>[6](https://libcxx.llvm.org/)</sup> For GCC 14, Clang 18, and VS 2022 17.10+, `std::print`/`println`, `std::expected`, `std::flat_map`/`flat_set`, `std::mdspan`, `std::move_only_function`, `std::stacktrace`, `std::out_ptr`/`inout_ptr`, and `std::byteswap` are available; `std::generator` is complete only in libc++, and `std::ranges::to` is partial in MSVC STL.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup>\n\n## By the numbers\n\n**Compile-time cost is measurable.** Including the whole C++23 standard library expands to 128,846 lines of preprocessed code under GCC with 1,175 ms net compile time, and 87,186 lines under Clang with 1,598 ms, up from 75,473 lines / 432 ms and 63,666 lines / 759 ms for the C++11 library.<sup>[8](https://github.com/whatchamacallem/cxx-std-include-bench/)</sup> Precompiled headers cut the whole-library include cost to 367 ms under GCC and 138 ms under Clang for C++23.<sup>[8](https://github.com/whatchamacallem/cxx-std-include-bench/)</sup> Within libc++, preprocessed `<vector>` alone expands to 2,046,574 bytes and `<iostream>` to 1,906,216 bytes.<sup>[13](https://github.com/llvm/llvm-project/issues/80196)</sup>\n\n**Runtime differences between implementations are small in microbenchmarks.** libc++ (Clang 17) constructed a string from `const char*` in 12 ns versus 15 ns for libstdc++ and 16 ns for MSVC STL, with SSO-path hits at 5 ns versus 8 ns and 7 ns; a vector benchmark showed libstdc++ (GCC 13) pushing back 1 million elements in 12 ms versus 11 ms for libc++ and 13 ms for MSVC STL.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup>\n\n**Adoption tracks standard age.** In the 2024 ISO C++ developer survey, 90.81% of respondents reported using C++11 features (auto, move semantics, `shared_ptr`, lambdas) \"pretty much\", 77.79% reported full use of C++17 features, 31.61% full use of C++20 features like concepts, coroutines, and modules, and 20.02% full use of C++23 features such as `expected` and `md_span`.<sup>[7](https://isocpp.org/files/papers/CppDevSurvey-2024-summary.pdf)</sup>\n\n## How it compares with Boost, Qt, and platform frameworks\n\nThe official name is C++ Standard Library, as defined in ISO 14882. The name \"STL\" at first denoted Alexander Stepanov's Standard Template Library; when portions of that library were incorporated into the C++ Standard Library, they were joined there by the ISO C runtime library, some Boost library components, and additional features.<sup>[5](https://learn.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-overview?view=msvc-170)</sup>\n\n## History\n\nThe modern library dates to a standards meeting presentation. At the San Jose meeting in November 1993, Alexander Stepanov, then an HP employee, gave a presentation on generic programming that put templates to substantial use; by the San Diego meeting the next March, he had refined his and Meng Lee's Standard Template Library to the point that the committee was ready to seriously consider it, even if it meant delaying completion of the standard.<sup>[14](https://stroustrup.com/cuj_interview.html)</sup> Stepanov's own development timeline places the Ada Generic Library with Dave Musser in 1986, STL with Meng Lee and Dave Musser in 1993 to 1994, and SGI STL with Matt Austern and Hans Boehm in 1995 to 1998.<sup>[15](https://www.stepanovpapers.com/stl.pdf)</sup> After approval, STL, along with iostreams, became a centerpiece of the standard C++ library.<sup>[14](https://stroustrup.com/cuj_interview.html)</sup>\n\n[Bjarne Stroustrup](https://www.edgepedia.org/bjarne-stroustrup), C++'s creator, credits the STL framework of containers, iterators, and algorithms as by far the most important standard-library component, saying that it and the generic programming techniques it pioneered saved C++ as a living modern language.<sup>[3](https://stroustrup.com/hopl20main-p5-p-bfc9cd4--final.pdf)</sup> C++11 modernized the library substantially: Josuttis's second-edition reference, covering the library as incorporated into C++11, extended its overall content by about 50% over the first edition, adding type traits, tuples, new containers, regular expressions, smart pointers, random numbers, clocks, and concurrency.<sup>[16](http://www.cppstdlib.com/cppstdlib.html)</sup> Within that revision, `auto_ptr`, C++98's early exclusive-ownership pointer, was replaced by `shared_ptr` for shared ownership and `unique_ptr` for exclusive ownership.<sup>[3](https://stroustrup.com/hopl20main-p5-p-bfc9cd4--final.pdf)</sup> The ISO C++ committee itself was founded in 1991 and produced the 1998 ISO standard, the baseline for the library's subsequent growth.<sup>[17](https://dl.acm.org/doi/10.1145/1238844.1238848)</sup>\n\n## Recent developments\n\nC++23 was finalized with `<flat_map>`, `<flat_set>`, and the `std` module among its additions.<sup>[2](https://cppreference.com/cpp/standard_library)</sup> For C++26, N5050 is the final draft and the initial draft for C++29, forming the basis of the Draft International Standard for C++26.<sup>[18](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/n5051.html)</sup> Standard library hardening was adopted for C++26, adding hardened preconditions for certain potentially out-of-bounds accesses to containers, `span`, `mdspan`, `string`, and `string_view`, whose violations in hardened implementations are checked at runtime and have terminating semantics.<sup>[9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3471r1.html)</sup><sup> • </sup><sup>[2](https://cppreference.com/cpp/standard_library)</sup> On the implementation side, GCC 14, Clang 18, and VS 2022 17.10+ collectively cover the C++23 feature set noted above, with remaining gaps concentrated in `std::generator` and `std::ranges::to`.<sup>[4](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)</sup>\n\n## References\n\n1. [C++ working draft, [library], WG21](https://eel.is/c++draft/library)\n2. [C++ Standard Library, cppreference.com](https://cppreference.com/cpp/standard_library)\n3. [Bjarne Stroustrup, Thriving in a Crowded and Changing World: C++ 2006–2020, HOPL IV](https://stroustrup.com/hopl20main-p5-p-bfc9cd4--final.pdf)\n4. [Standard Library Implementation, cpp.wyattau.com](https://cpp.wyattau.com/enviroment_and_toolchain/1_compiler_and_standards/3_standard_library_implementation/)\n5. [C++ Standard Library Overview (STL), Microsoft Learn](https://learn.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-overview?view=msvc-170)\n6. [libc++ C++ Standard Library documentation, LLVM](https://libcxx.llvm.org/)\n7. [2024 Annual C++ Developer Survey \"Lite\", Standard C++ Foundation](https://isocpp.org/files/papers/CppDevSurvey-2024-summary.pdf)\n8. [cxx-std-include-bench, GitHub](https://github.com/whatchamacallem/cxx-std-include-bench/)\n9. [P3471R1: Standard Library Hardening, WG21](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3471r1.html)\n10. [C++ working draft, [headers], WG21](https://eel.is/c++draft/headers)\n11. [How do developers use C++ libraries? An empirical study, SEKE 2015](https://ksiresearch.org/seke/seke15paper/seke15paper_9.pdf)\n12. [The Standard Template Library, Alexander Stepanov](https://www.stepanovpapers.com/STL/DOC.PDF)\n13. [[libc++] Extreme preprocessed size of core headers, LLVM issue 80196](https://github.com/llvm/llvm-project/issues/80196)\n14. [C++: The Making of a Standard; Stroustrup Interviews](https://stroustrup.com/cuj_interview.html)\n15. [STL and Its Design Principles, Alexander Stepanov](https://www.stepanovpapers.com/stl.pdf)\n16. [The C++ Standard Library, 2nd Edition, Nicolai Josuttis](http://www.cppstdlib.com/cppstdlib.html)\n17. [Evolving a language in and for the real world: C++ 1991–2006, HOPL III, ACM](https://dl.acm.org/doi/10.1145/1238844.1238848)\n18. [N5051 Editors' Report, WG21](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/n5051.html)\n\n---\n*Topic: Encyclopedia › Technology and the built world › Computing and digital systems › Software and programming › Development tools and collaboration infrastructure › Frameworks, libraries, and APIs › Mobile and platform frameworks*\n\n*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*\n\n*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*\n\nLicense: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license\n",
 "same_as": [],
 "url": "https://www.edgepedia.org/c-standard-library-ep2gtn4f1q",
 "markdown_url": "https://www.edgepedia.org/c-standard-library-ep2gtn4f1q.md",
 "license": {
  "name": "Edgepedia Community License 1.0",
  "url": "https://www.edgepedia.org/edgepedia/license",
  "summary": "Free with credit, commercial use included. AI training is open to everyone. For other uses, organizations over USD 100M in revenue or 100M monthly users license separately.",
  "spdx": "LicenseRef-Edgepedia-Community-1.0"
 },
 "credit": "\"C++ Standard Library\", Edgepedia (EdgeChat), https://www.edgepedia.org/c-standard-library-ep2gtn4f1q. Edgepedia Community License 1.0.",
 "credit_md": "\"[C++ Standard Library](https://www.edgepedia.org/c-standard-library-ep2gtn4f1q)\", Edgepedia (EdgeChat), [https://www.edgepedia.org/c-standard-library-ep2gtn4f1q](https://www.edgepedia.org/c-standard-library-ep2gtn4f1q). [Edgepedia Community License 1.0](https://www.edgepedia.org/edgepedia/license).",
 "credit_html": "\"<a href=\"https://www.edgepedia.org/c-standard-library-ep2gtn4f1q\">C++ Standard Library</a>\", Edgepedia (EdgeChat), <a href=\"https://www.edgepedia.org/c-standard-library-ep2gtn4f1q\">https://www.edgepedia.org/c-standard-library-ep2gtn4f1q</a>. <a href=\"https://www.edgepedia.org/edgepedia/license\">Edgepedia Community License 1.0</a>.",
 "speakable": "The C++ Standard Library is the set of headers and components defined in the ISO C++ standard, supplying containers, algorithms, strings, numerics, and concurrency, mostly in namespace std."
}
