Studying the C++ STL and Experiencing a sudden Problem. Please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Studying the C++ STL and Experiencing a sudden Problem. Please help me

I've been studying c++ and I have used Google and didn't find an explanation I understand. Even WikiPedia is doing the same thing. Can please tell me about allocators, what they are and how to use them.

28th May 2017, 5:38 PM
Luyanda
Luyanda - avatar
5 Answers
+ 4
http://en.cppreference.com/w/cpp/memory/allocator this may be useful. Your question had me curious so I looked it up. Seems the allocator is a class object defined in <memory>. From what I can tell is it is an object used to get the assigned memory to an object or assign memory to a new object. It's purposes seems to be for dynamic memory management. Hope this helps some.
1st Jun 2017, 5:23 PM
Michael Simnitt
Michael Simnitt - avatar
+ 3
yeah thanks but do you have any clue on how to declare and use it?
28th May 2017, 9:03 PM
Luyanda
Luyanda - avatar
+ 2
sdltutorials.com
28th May 2017, 10:15 PM
Michael Simnitt
Michael Simnitt - avatar
+ 1
I think an allocator is something that somehow "prepares" the memory for a certain object of a certain size, so you can save something in there, it is used for containers like vector
28th May 2017, 8:23 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
0
it's on cppreference
29th May 2017, 6:17 AM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar