Hi,
I'm trying to implement my own allocator using malloc and free. One thing what interests me is that in declaration of deallocate in addition to pointer we have also parameter size which suppose to be size of elements allocated with allocate but having implemented my deallocate as this:

template<typename T>
void Allocator<T>::deallocate(pointer p, size_type n)
{
     free(p);
}

I have no idea for what I should use this (size_type) parameter.
Looking forward to your reply.
Thank you.

I have no idea for what I should use this (size_type) parameter.

If your allocator does not need it, do not worry about it. The allocator interface was designed to be generic, and some allocators will need that information to manage the memory. For example, moving blocks from a 'used' pool to a 'free' pool means knowing how many blocks to move. Or more simply, the size could be used for debug information.

Tom Gunn - Thanks a lot!!! Now I can relax and watch some tv. Once again - thanks

This question has already been answered. Start a new discussion instead.