deque get_allocator in C++ STL Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report deque::get_allocator() is a built in function in C++ STL which is used to get allocator of container deque. Syntax: Allocator_type get_allocator() Parameters: This function does not accept any parameter. Return value: Returns an allocator associated with deque. Below programs illustrate the working of deque::get_allocator() function. Example-1: CPP // CPP program to illustrate // deque get_allocator() #include <bits/stdc++.h> using namespace std; int main() { //'de' is object of 'deque' deque<int> de; //'allocator_type' is inherit in 'deque' //'d' is object of 'allocator_type' deque<int>::allocator_type d = de.get_allocator(); // Comparing the Allocator with Pair<int, int> cout << "Is allocator Pair<int, int> : " << boolalpha << (d == allocator<pair<int, int> >()); return 0; } Output:Is allocator Pair : true Example-2: CPP // CPP program to illustrate // deque get_allocator() #include <bits/stdc++.h> using namespace std; int main(void) { // Creating a container of type deque deque<int> de; // creating a pointer of type int int* array; // creating array using mylist get_allocator array = de.get_allocator().allocate(3); // inserting some data into array for (int i = 0; i < 3; i++) array[i] = i; // printing details of array for (int i = 0; i < 3; i++) cout << array[i] << " "; return 0; } Output:0 1 2 Time complexity: O(1). Auxiliary Space: O(n). // n is the size of the deque. Comment More infoAdvertise with us Next Article Interview Preparation For Software Developers A ankit15697 Follow Improve Article Tags : C++ STL cpp-deque cpp-deque-functions Practice Tags : CPPSTL Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like