Skip to content

libstdc++ (GCC) Source-Level Deep Analysis

Source path: references/impl/gcc/libstdc++-v3/include/

GCC's C++ standard library implementation, the de facto standard in the Linux ecosystem. Core design philosophy: ABI stability takes priority over aggressive optimization.

Table of Contents

ChapterContent
string ABI MigrationCOW → SSO migration, dual ABI coexistence, __cxx11 namespace
vector and _Hashtablevector growth strategy, unordered_map node-based _Hashtable
shared_ptr / RB-tree / functionControl block, _Rb_tree sentinel node, function pointer SBO

Three-Implementation Comparison

Componentlibstdc++ (GCC)libc++ (LLVM)MSVC STL
sizeof(string)322432
string SSO152215
string COWyes (ABI v1)nono
vector relocatemove+destroymemcpymove+destroy
function polymorphismfunction pointervtablefunction pointer
unordered_mapnode-based _Hashtablechainingchaining
ABI stabilitystrongest (abi_tag)versionedstrong

Choose libstdc++ for: Linux servers, strongest ABI compatibility, conservative and stable implementation strategy, HPC.

Released under the MIT License