| 58 | } |
| 59 | |
| 60 | pointer allocate(size_type n, |
| 61 | MallocAllocator<void>::const_pointer /* hint */ = 0) { |
| 62 | |
| 63 | if (n > this->max_size()) |
| 64 | throw std::bad_alloc(); |
| 65 | pointer ptr = static_cast<pointer>(std::malloc(n * sizeof(T))); |
| 66 | if (!ptr) |
| 67 | throw std::bad_alloc(); |
| 68 | return ptr; |
| 69 | } |
| 70 | |
| 71 | void deallocate(pointer p, size_type /* n */) { |
| 72 | std::free(static_cast<void*>(p)); |