unordered_multimap get_allocator in C++ STL Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report unordered_multimap::get_allocator() is a built in function in C++ STL which is used to get allocator of container unordered_mulitmap. Syntax: Allocator_type get_allocator() Parameters: This function does not accept any parameter. Return value: Returns an allocator associated with unordered_multimap. Below programs illustrate the working of unordered_multimap::get_allocator() function. Example-1: CPP // CPP program to illustrate // unordered_multimap get_allocator() #include <bits/stdc++.h> using namespace std; int main() { //'ump' is object of 'unordered_multimap' unordered_multimap<int, int> ump; //'allocator_type' is inherit in 'unordered_multimap' //'u' is object of 'allocator_type' unordered_multimap<int, int>::allocator_type u = ump.get_allocator(); // Comparing the Allocator with Pair<int, int> cout << "Is allocator Pair<int, int> : " << boolalpha << (u == allocator<pair<int, int> >()); return 0; } Output:Is allocator Pair : true Example-2: CPP // CPP program to illustrate // unordered_multimap get_allocator() #include <bits/stdc++.h> using namespace std; int main(void) { unordered_multimap<char, int> um; pair<const char, int>* a; a = um.get_allocator().allocate(8); cout << "Allocated size = " << sizeof(*a) * 8 << endl; return 0; } Output:Allocated size = 64 Time complexity: O(1). Auxiliary space: O(1). Create Quiz Comment A ankit15697 Follow 0 Improve A ankit15697 Follow 0 Improve Article Tags : C++ STL cpp-unordered_multimap cpp-unordered_map-functions Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like