typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
template <class u>
struct rebind { typedef malloc_allocator<u> other; };
malloc_allocator() {}
malloc_allocator(const malloc_allocator&) {}
template <class u>
malloc_allocator(const malloc_allocator<u>&) {}
~malloc_allocator() {}
pointer address(reference x) const { return &x; }
const_pointer address(const_reference x) const {
return x;
}
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);
}
void deallocate(pointer p, size_type) { std::free(p); }