Every stl container take an allocator as a parameter:
template < class T, class Allocator = allocator<T> > class vector;
If you write your own class It is possible to use your own allocator. But is it possible to write your own allocator without using templates?
For example, writing this function is not easy if you are not allowed to use templates
pointer allocate(size_type n, const_pointer = 0) {
void* p = std::malloc(n * sizeof(T));
if (!p)
throw std::bad_alloc();
return static_cast<pointer>(p);
}
Because how could you know the size of T?