deferred_resn
Last change
on this file since 4cf2472 was 73abe95, checked in by Thierry Delisle <tdelisle@…>, 7 years ago |
Replace extension-less headers with .hfa
|
-
Property mode
set to
100644
|
File size:
367 bytes
|
Rev | Line | |
---|
[e8b15358] | 1 |
|
---|
| 2 | #include <stdbool.h>
|
---|
[73abe95] | 3 | #include <stdlib.hfa>
|
---|
[e8b15358] | 4 |
|
---|
| 5 | trait allocator_c(otype T, otype allocator_t)
|
---|
| 6 | {
|
---|
| 7 | void realloc(allocator_t* const, size_t);
|
---|
| 8 | };
|
---|
| 9 |
|
---|
| 10 | forall(otype T)
|
---|
| 11 | struct heap_allocator
|
---|
| 12 | {
|
---|
| 13 | T* storage;
|
---|
| 14 | size_t capacity;
|
---|
| 15 | };
|
---|
| 16 |
|
---|
| 17 | forall(otype T)
|
---|
| 18 | inline void realloc(heap_allocator(T) *const this, size_t size)
|
---|
| 19 | {
|
---|
| 20 | this->storage = (T*)realloc((void*)this->storage, this->capacity);
|
---|
| 21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.