C++ STL (Standard Template Library) - javatpoint
C++ STL (Standard Template Library) - javatpoint
prev next
Following are the containers that give the details of all the containers as
well as the headerAdvertisement
file and the type of iterator associated with them :
ADVERTISEMENT
ADVERTISING
Classification of containers :
Sequence containers
Associative containers
Derived containers
ITERATOR
Iterators are pointer-like entities used to access the individual
elements in a container.
Iterator Categories
Iterators are mainly divided into five categories:
1. Input iterator:
2. Output iterator:
It is a one-way iterator.
3. Forward iterator:
4. Bidirectional iterator:
output *p = v ++
Algorithms
Algorithms are the functions used across a variety of containers for
processing its contents.
Points to Remember:
FUNCTION OBJECTS
A Function object is a function wrapped in a class so that it looks like an
object. A function object extends the characteristics of a regular
function by using the feature of aN object oriented such as generic
programming. Therefore, we can say that the function object is a smart
pointer that has many advantages over the normal function.
d();
d.operator() ( );
Test it Now
#include <iostream>
using namespace std;
class function_object
{
public:
int operator()(int a, int b)
{
return a+b;
}
};
int main()
{
function_object f;
int result = f(5,5);
cout<<"Addition of a and b is : "<<result;
return 0;
}
Test it Now
Output:
Addition of a and b is : 10
Next Topic #
prev next
ADVERTISEMENT
Latest Courses