diff options
author | ZoRo <dos21h@gmail.com> | 2018-08-04 09:36:29 +0100 |
---|---|---|
committer | ZoRo <dos21h@gmail.com> | 2018-08-04 09:36:29 +0100 |
commit | 7213af916cbb0087a6b85c800311c3f6a60c13b3 (patch) | |
tree | 50ead29d81824ce5734b95903e2f8e16607d9d69 /darray.h | |
parent | 5a112810cfc0849c170c89f32b9f2192c8b37a96 (diff) | |
download | notifylist-7213af916cbb0087a6b85c800311c3f6a60c13b3.tar.gz notifylist-7213af916cbb0087a6b85c800311c3f6a60c13b3.zip |
Diffstat (limited to 'darray.h')
-rw-r--r-- | darray.h | 37 |
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 + |