Custom Memory Allocator for STL map
- by Prasoon Tiwari
This question is about construction of instances of custom allocator during insertion into a std::map.
Here is a custom allocator for std::map<int,int> along with a small program that uses it:
#include <stddef.h>
#include <stdio.h>
#include <map>
#include <typeinfo>
class MyPool {
public:
void * GetNext() {
…