A dynamic list using fast memory management (golden ratio increase)
- Install the library
em list
em install
em build lib
- Include in a file
#include "EmeraldsVector.h"
int main(void) {
/* Create a new vector object */
EmeraldsVector *v = vector_new();
/* Add a void* value into the vector */
vector_add(v, (void*)1);
vector_add(v, (void*)"value"); /* Can hold heterogenous data */
printf("%s\n", (char*)vector_get(v, 1));
printf("%d\n", (long)vector_get(v, 0));
}
- Provide a custom free function pointer for specific deallocations (also to set a framework for an efficient garbage collector)
- Figure out word size of machine for correct conversions
- Fork it (https://github.com/Oblivious-Oblivious/EmeraldsVector/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- oblivious - creator and maintainer