Standard Template library (STL) in C++
It has a set of pre-built classes and functions. Data’s need to store in some type data structures like vectors, stacks and maps. If your programming language gives the standard template library, it is efficient to programmers.
Features:
STL has
lot of benefits as follows…
- · Reusability.
- · Efficiency.
- · Quick
to execute.
- · Pre-defined
algorithms.
What are the components of STL?
It has
three types classified as follows.
Algorithms:
It has
a collection of functions which provides the common operations.
For example, sorting, searching, manipulating and updating
on data. It uses the built in header files <numeric> and
<algorithm>.
Sample algorithms are given below.
Sort : it sorts the data in ascending order.
Search:
Binary Search :it searches the data using binary
search.
Find: it searches the data.
Manipulation:
Accumulate: it adds the elements.
Count: it gives you the occurrence of value in the
range.
Reverse: it reverses the order of elements.
Unique: it eliminates the duplicate elements.
Lower bound: it
gives you the lower bound.
Upper bound: it returns the upper bound.
Updating:
Replace: it replace a value to other value in the given
range.
Containers:
It is
the structure to store objects and data based on the requirements. Generally,
container is created as template, the methods are executed over it.
It has four types.
Associative containers: it has set, multiset,map and
multimap.
Unordered associated containers:all unordered types
like set,map,multimap.
Container adaptors: stack,queue
Sequence containers: Array,list,Deque and vector.
Iterators:
It points the
memory addresses of STL containers. It’s like a pointer. It is defined in
<iterator> header file.
These are the introduction about STL(Standard Template
Library) in C++. Hope, this introduction is help to you. Keep Reading!!!
Comments
Post a Comment