What are Standard Libraries in C++?

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 −

  •  Streams − These libraries are used to deal with different types of streams available in C++. For example, fstream represents the file stream generally, and this class can be used to create files, write information to files, and read information from files, sstream represents a string stream and is generally used to manipulate strings, etc.
  •  Containers − 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.
  •  Threading − This is a library introduced in C++11 that basically deal 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'.

Note that the Standard libraries in C++ are different from the Standard template library(STL) which is a subset of the Standard Library.

Updated on: 10-Feb-2020


Kickstart Your Career

Get certified by completing the course

Get Started