unordered_multiset get_allocator in C++ STL
Last Updated :
11 Oct, 2018
The unordered_multiset::get_allocator() function is a STL function in C++ which is used to include unorder_multiset header file in program. This function gets the stored allocator object and returns the allocator object which is used to construct the container. It is a public member function.
Syntax:
allocator_type get_allocator() const;
Here allocator_type is the type of the allocator which is used by the container.
Parameters: It does not accepts any parameter.
Return Value: It returns the allocator type.
Below program illustrate get_allocator method in C++ STL:
Program:
#include <iostream>
#include <unordered_set>
using namespace std;
int main()
{
unordered_multiset< int > m;
unordered_multiset< int >::allocator_type t = m.get_allocator();
cout << "allocator is : "
<< boolalpha << (t == allocator<std::pair< int , int > >());
return (0);
}
|
Output:
allocator is : true
Complexity: It takes constant time of complexity to perform operation.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...