Standard C++ library(includes C++11 Library)

The standard C++ Library consists of two types:
 
i)C++ standard library. and
 
ii)C standard Library.


C++ library

This library comes with the C++ compiler and they are part of the standard C++ language. They are written using class and template.We can divide them into multiple types based on their functionality.


Input output stream library:I/O stream library deals with the input and output of data.Input and output of data can be perform either through monitor or through files. The I/O headers included in C++ are : <iostream>,<istream> ,<ostream> , <fstream> , <iomanip> , <ios> , <iosfwd> , <streambuf> , <sstream> and <strstream>. We will discuss more about this in I/O stream chapter.

String:The header <string> is used to include this library.The main function of this library is manipulation of string.More about this library will be discuss in the chapter String.

Containers,iterators and algorithm:Containers create a storage to hold a collection of objects. They are like array except their size is not fixed and can be increased. Iterators are used to access and manipulate the containers. The headers included are: <vector> , <map> , <array> , <unordered_map> , <unordered_set> , <set> , <stack> , <queue> , <bitset> , <deque> , <forward> and <list>.

Algorithm consists of width variety of functions that can perform operations on template library using an iterators. The header <algorithm> is used to include the function present in this library. Some of the functions of <algorithm> library are binary_search , count , remove_copy, count_if, remove_copy_if, equal, equal_range, replace , fill , replace_copy , replace_copy_if , find, replace_if, find_if,reverse_copy, generate, set_difference, lexicographical_compare, sort_heap, swap , unique_copy,etc .More about his libarary and it’s functions will be discuss in the Chapter Container , iterators and Algorithm.

Locale Library: This library allows the programmer to implement C++ for various cultural diversities.For instance printing out string in another language or conversion between different currencies.The header <locale> is use to include the library.

Diagnostic Library:As the name suggests this library diagnose the errors in our programs. To use diagnostic library include <exception> , <stdexcept> or <cassert> (derive from C library).

Language Support Library: Such library support the C++ language implicitly. Programmers using features like new , delete, exception handling, RTTI,etc. calls the library indirectly. The headers are <exception> , <limits>, <new> and <typeinfo>.

Numerics Library : Numerics library provides programmer with some functions that will help in numerical operation. The operations involving sequence of numbers, complex number and array as a whole can be dealt with using this library. The headers for this library are <numeric> , <complex> and <valarray>.

General utility: The header’s are <memory> , <functionality> and <utility>. These libraries can perform operations on objects, so they are mainly used by other standard library.

Multi-thread Library: A thread is nothing but a sequence of code, so multi-thread programming means running the code concurrently not simultaneously. C++ does not support this features but C++11 added this new library to support multi-threading in C++. We will discuss more about this later in the tutorial.




C standard library

This Libraries are acquired from Standard C language. The naming convention of these libraries are a bit different in C++. The header’s file name for any C standard has an extension of .h for instance #include <stdio.h> . However, while using in C++ the .h extension is omitted and ‘c‘ is added in front of the library header’s name. So stdio.h in C++ will be written as #include <cstdio> .The library of Standard C and their corresponding names in standard C++ are given below.

C and C++ standard header C++ standard headers
assert.h <cassert>
ctype.h <cctype>
errno.h <cerrno>
fenv.h <cfenv>
float.h <cfloat>
inttypes <cinttypes>
iso646.h <ciso646>
limits.h <climits>
locale.h <clocale>
math.h <cmath>
setjmp.h <csetjmp>
signal.h <csignal>
stdarg.h <cstdarg>
stdbool.h <cstdbool>
stddef.h <cstddef>
stdint.h <cstdint>
stdio.h <cstdio>
stdlib.h <cstdlib>
string.h <cstring>
tgmath.h <ctgmath>
time.h <ctime>
uchar.h <cuchar>
wchar.h <cwchar>
wctype.h <cwctype>