The standard C++ Library consists of two types:
i)C++ standard library. and
ii)C standard 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 on file.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:Container create a storage to hold a collection of object.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 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 suggest this library diagnose the error in our program.To use diagnostic library include <exception> , <stdexcept> or <cassert> (derive from C library).
Language Support Library:Such library support the C++ language implicitly.Programmer 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 operation 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 library can perform operation 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 Library are acquired from Standard C language.The naming convention of these library 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|
You can still use C library in your C++ program using the same old .h notation,meaning you can still use either <stdio.h> or <cstdio> in your program. In some compiler using C library( with .h) does not require namespacing the function with std for instance,if you are using <stdio.h> you can use the function putchar() without attaching std:: in front ,but using <cstdio> may demand for namespacing the function putchar() with std. MinGw(used in Code::blocks) compiler doesn’t require such specification so namespacing is not necessary for all the C library.