allocates, but does NOT initialize. Use in-place new constructor, e.g. T* obj = pool.allocate(); ::new (static_cast (obj)) T();
| 415 | // T* obj = pool.allocate(); |
| 416 | // ::new (static_cast<void*>(obj)) T(); |
| 417 | T* allocate() { |
| 418 | T* tmp = mHead; |
| 419 | if (!tmp) { |
| 420 | tmp = performAllocation(); |
| 421 | } |
| 422 | |
| 423 | mHead = *reinterpret_cast_no_cast_align_warning<T**>(tmp); |
| 424 | return tmp; |
| 425 | } |
| 426 | |
| 427 | // does not actually deallocate but puts it in store. |
| 428 | // make sure you have already called the destructor! e.g. with |
no outgoing calls