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, functional, and iterators.
The STL provides a ready-made set of common classes for C++, such as containers and associative arrays, that can be used with any built-in type and with any user-defined type that supports some elementary operations (such as copying and assignment). STL algorithms are independent of containers, which significantly reduces the complexity of the library.
containers
are a kind of holder objects having a collection of other objects , they are a kind of class templates allowing greater flexibility. This simply means allthe following containers are already defined you just need to include them and start using them .
array-
array of fixed size , here you can make an array of size 100000 without any problem which will not work with normal array that we are familiar with.you need to include array like this
#include<array>
deque -
double ended queue has dynamic size and can be expanded and contracted on both the ends
#include<deque>
list -
insertion and deletion at any positon takes same time iteration in both directions . #include<list>
queue and priority queue -
we have here predefined functions for insertion deletion and accessing an element #include<queue>
vector -
they are a kind of expandable arrays #include<vector>
note --->
for using the array container class you need a dev c++ compiler . Also you need to do the following :1. go to Tools -> compiler options
2. in conmpiler tab in the second text area below "Add the following commands when calling linker " write -std=c++11 after whatever is written and press ok
No comments:
Post a Comment
THANKS FOR UR GREAT COMMENT