The get_allocator() method of unordered_set is the part of Standard Template Library(STL) of C++. This method gets the stored allocator object and returns it.
Allocator_type get_allocator() const;
where allocator_type is the type of the allocator used by the container.
Return Value: It returns the allocator object used to construct the container.
Exceptions: In this method, Exception is thrown if any element comparison object throws exception.
Below program illustrate the unordered_set::get_allocator() function
Is allocator Pair
It takes constant(O(1)) time of complexity to perform an operation.
Program 2 :
Allocated size = 64
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.