What's the difference between "STL" and "C++ Standard Library"?

C++Server Side ProgrammingProgramming

The Standard Template Library (STL) is a software library for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components called algorithms, containers, functions, and iterators. Note that the term "STL" or "Standard Template Library" does not show up anywhere in the ISO 14882 C++ standard. So referring to the C++ standard library as STL is wrong, ie, STL and C++ Standard Library are 2 different things with the former being the subset of the latter.

The STL consists of


The STL contains sequence containers and associative containers. Containers are objects that store data. The standard sequence containers include vector, deque, and list. The standard associative containers are set, multiset, map, multimap, hash_set, hash_map, hash_multiset, and hash_multimap. There are also container adaptors queue, priority_queue, and stack, which are containers with a specific interface, using other containers as implementation.


An iterator is an object that enables a programmer to traverse a container. The STL implements five different types of iterators: input (used to read a sequence of values), output (used to write a sequence of values), forward (that can be read, written to, and move forward), bidirectional (like forward iterators, but can also move backward) and random access (move freely any number of steps in one operation). Iterators are the major feature that allows the generality of the STL.


Algorithms in STL is a collection of functions specially designed to be used on ranges of elements. A range is any sequence of objects that can be accessed through iterators or pointers, such as an array or an instance of some of the STL containers. Examples of algorithms in STL: sort (Sort elements in range), binary_search (Test if a value exists in sorted sequence), min_element (Return smallest element in range), etc. Note that all these algorithms can be applied to any data type accepted as a template.

In the C++ programming language, the C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Standard itself. The C++ Standard Library provides several generic containers, functions to utilize and manipulate these containers, function objects, generic strings and streams (including interactive and file I/O), support for some language features, and functions for everyday tasks such as finding the square root of a number. Following are some of the features of the C++ standard library −


These libraries are used to deal with different types of streams available in C++. For example, a stream represents the file stream generally, and this class can be used to create files, write information to files, and read information from files, a stream represents a string stream and is generally used to manipulate strings, etc.


This is a collection of classes that are used to store data in various data types like vectors, sets, maps, stacks, queue, etc. These are a component of the STL.

General libraries

Libraries like algorithm, Chrono for time, iterator, memory, etc.

Numerics library

This library is a collection of components that C++ programs may use to perform seminumerical operations. For example,  <complex> defines a class template, and numerous functions for representing and manipulating complex numbers, <random> is used for generating (pseudo-)random numbers, etc.


This is a library introduced in C++11 that basically deals with concurrency.

C Standard Library

Each header from the C Standard Library is included in the C++ Standard Library under a different name, generated by removing the .h, and adding a 'c' at the start; for example, 'time.h' becomes 'ctime'.

Published on 28-Feb-2018 16:19:19