diff options
| author | Syndamia <kamen@syndamia.com> | 2026-04-28 14:06:44 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-05-12 07:08:56 +0300 |
| commit | 0d249b1d47a7f84cfe5f09ad070d1affd26566da (patch) | |
| tree | f395f67eecb27daea3fc4a9ad8e59bf40f988984 /Vector.h | |
| parent | 5c36b582ad60a569ed996fe188ed92ef6bd7fc5f (diff) | |
| download | foollib-0d249b1d47a7f84cfe5f09ad070d1affd26566da.tar foollib-0d249b1d47a7f84cfe5f09ad070d1affd26566da.tar.gz foollib-0d249b1d47a7f84cfe5f09ad070d1affd26566da.zip | |
feat!: Refactor using MemoryManager
The idea is to provide a universal memory management "API", through
which you allocate and deallocate. This allows our implementations (for
String and Vector) to be more generic.
It does also allow usage of different allocators depending on situation.
Diffstat (limited to 'Vector.h')
| -rw-r--r-- | Vector.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Vector.h b/Vector.h new file mode 100644 index 0000000..ae82c23 --- /dev/null +++ b/Vector.h @@ -0,0 +1,18 @@ +#ifndef _VECTOR +#define _VECTOR + +#include "Types.h" +#include "MemoryManager.h" + +typedef void* Vector; + +Vector V_new(MemoryManager *mm, usize element_size, usize length); +usize V_length(Vector arr); +usize V_count(Vector arr); +void* V_top(Vector arr); +Result V_push(Vector *arr, void *pointer_to_value); +Result V_pushp(Vector* *arr, void *value); +Result V_pop(Vector *arr); +Result V_free(Vector *arr); + +#endif /* _VECTOR */ |
