summaryrefslogtreecommitdiff
path: root/darray.h
diff options
context:
space:
mode:
Diffstat (limited to 'darray.h')
-rw-r--r--darray.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/darray.h b/darray.h
new file mode 100644
index 0000000..04cbc6a
--- /dev/null
+++ b/darray.h
@@ -0,0 +1,37 @@
+#ifndef __DARRAY_H
+#define __DARRAY_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#define DEFAULT_EXPAND_RATE 10
+
+class DArray
+{
+private:
+ int end;
+ int _max;
+ //size_t size;
+ size_t _expand;
+ void **data;
+public:
+ DArray(size_t data_size, size_t init_size);
+ ~DArray();
+ void clear();
+ void clead_idx(int idx);
+ int expand();
+ int resize(size_t size);
+ int push(void *val);
+ void *pop();
+ int set(int idx, void *val);
+ void* get(int idx);
+ void *last();
+ void *first();
+ int count();
+ int max();
+};
+
+#endif
+