The program should do the following:
1. Reserve a memory array (like int*) that is constructed by the constructor of the Allocator class. For example, this function can be realized as follows:
Allocator(int max_size)
{
memory = new int[max_size]; // it is a private variable
_max_size = max_size; //it is a private variable
}
Note, that max_size should be a degree of 2.
Also, the destructor ~Allocator() should be realized too.
2. Alloc a piece of the reserved memory as follows:
void* Alloc(int max_size)
{
// here should be the function's body
}
3. Free a piece of the memory reserved early as follows:
void Free(void * memory_ptr)
{
// here should be the function's body
}
| Гарантия на работу | 1 год |
| Средний балл | 4.53 |
| Стоимость | Назначаете сами |
| Эксперт | Выбираете сами |
| Уникальность работы | от 70% |