Go to the documentation of this file. 20 #define Vector(t) struct {int size, capacity; t *data; } 26 #define vectInit(vect) ((vect).size = (vect).capacity = 0, (vect).data = 0) 32 #define vectFree(vect) free((vect).data) 40 #define vectAt(vect, index) ((vect).data[(index)]) 47 #define vectSize(vect) ((vect).size) 55 #define vectPush(type, vect, value) do { \ 56 if((vect).size == (vect).capacity) { \ 57 (vect).capacity = ((vect).capacity ? (vect).capacity * 2 : 10); \ 58 (vect).data = (type*)realloc((vect).data, sizeof(type) * (vect).capacity); \ 60 (vect).data[(vect).size++] = value; \ 69 #define vectIndexOf(vect, value, out) do { \ 71 for(int _i = 0; _i < vectSize(vect); ++_i) { \ 72 if(vectAt(vect, _i) == value) { \ 83 #define vectRemoveLast(vect) do { \ 84 if((vect).size > 0) { \ 95 #define vectResize(type, vect, sizeToIncrease) do { \ 96 if(((sizeToIncrease)+(vect).size) < (vect).capacity) { \ 97 (vect).size += sizeToIncrease; \ 99 (vect).data = (type*)realloc((vect).data, sizeof(type) * (sizeToIncrease)); \ 100 (vect).size += (sizeToIncrease); \ 101 (vect).capacity += (sizeToIncrease); \ 111 #define vectFill(type, vect, sizeToInit) do { \ 112 (vect).size = (vect).capacity = (sizeToInit); \ 113 (vect).data = (type*)malloc(sizeof(type) * (sizeToInit)); \