C++ LANGAGE TUTORIALS LEARN STL IN C++
Trust you as of now comprehend the idea of C++ Template which we as of now have talked about in one of the sections. The C++ STL (Standard Template Library) is an effective arrangement of C++ layout classes to gives broadly useful templatized classes and capacities that execute numerous mainstream and normally utilized calculations and information structures like vectors, records, lines, and stacks.
At the center of the C++ Standard Template Library are taking after three all around organized parts:
At the center of the C++ Standard Template Library are taking after three all around organized parts:
Component | Description |
---|---|
Containers | Containers are used to manage collections of objects of a certain kind. There are several different types of containers like deque, list, vector, map etc. |
Algorithms | Algorithms act on containers. They provide the means by which you will perform initialization, sorting, searching, and transforming of the contents of containers. |
Iterators | Iterators are used to step through the elements of collections of objects. These collections may be containers or subsets of containers. |
We will examine about all the three C++ STL segments in next section while talking about C++ Standard Library. For the time being, remember that all the three parts have a rich arrangement of pre-characterized capacities which help us in doing convoluted undertakings in simple mold.
Give us a chance to take the accompanying project shows the vector holder (a C++ Standard Template) which is like a cluster with a special case that it naturally handles its own stockpiling prerequisites on the off chance that it develops:
At the point when the above code is ordered and executed, it creates the accompanying result:
Here are taking after focuses to be noted identified with different capacities we utilized as a part of the above case:
The push_back( ) part work embeds esteem toward the end of the vector, extending its size as required.
The size( ) work shows the span of the vector.
The capacity start( ) gives back an iterator to the begin of the vector.
The capacity end( ) gives back an iterator to the end of the vector.
Comments
Post a Comment