STL (Standard Template Library) เป็นไลบรารีซอฟต์แวร์สำหรับ C++ ที่มีอิทธิพลต่อหลายส่วนของ C++ Standard Library ประกอบด้วย 4 ส่วนหลัก: algorithms, containers, functions, iterators
สำคัญ: คำว่า "STL" ไม่ได้ปรากฏในมาตรฐาน ISO 14882 C++ เลย การเรียก C++ Standard Library ว่า STL จึงไม่ถูกต้อง - STL เป็นเพียง subset ของ Standard Library
STL ประกอบด้วย
Containers (คอนเทนเนอร์)
- Sequence containers:
vector,deque,list - Associative containers:
set,multiset,map,multimap,hash_set,hash_mapฯลฯ - Container adaptors:
queue,priority_queue,stack
Iterators (อิเทอเรเตอร์)
ออบเจ็กต์สำหรับ traverse container มี 5 ประเภท: input, output, forward, bidirectional, random access
Algorithms (อัลกอริทึม)
ฟังก์ชันสำหรับทำงานบน range ของ elements เช่น sort, binary_search, min_element ทำงานกับทุกชนิดข้อมูลที่รองรับ template
C++ Standard Library
รวม classes และ functions ที่เป็นส่วนของ ISO C++ Standard เอง ประกอบด้วย:
- Streams:
fstream,stringstreamฯลฯ - Containers: (รวม STL containers ด้วย)
- General libraries:
algorithm,chrono,iterator,memoryฯลฯ - Numerics library:
complex,randomฯลฯ - Threading: รองรับ concurrency (C++11+)
- C Standard Library: header แบบ C เช่น
ctime(จากtime.h)