summaryrefslogtreecommitdiff
path: root/include/lib/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/vector.h')
-rw-r--r--include/lib/vector.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/lib/vector.h b/include/lib/vector.h
new file mode 100644
index 0000000..33e5b97
--- /dev/null
+++ b/include/lib/vector.h
@@ -0,0 +1,21 @@
+#ifndef VECTOR_H
+#define VECTOR_H
+
+#include <stddef.h>
+
+/**
+ * A simple pointer-only C++-style vector.
+ */
+
+struct vector {
+ size_t size;
+ size_t capacity;
+ void** buffer;
+};
+
+int vector_init(struct vector *v);
+int vector_resize(struct vector *v, size_t nc);
+int vector_emplace_back(struct vector *v, void *p);
+int vector_deinit(struct vector *v);
+
+#endif