Util: Add Vector append

This commit is contained in:
Jeffrey Pfau 2015-02-04 02:34:59 -08:00
parent 09cd56820f
commit f62c068a2c
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@
void NAME ## Init(struct NAME* vector, size_t capacity); \
void NAME ## Deinit(struct NAME* vector); \
TYPE* NAME ## GetPointer(struct NAME* vector, size_t location); \
TYPE* NAME ## Append(struct NAME* vector); \
void NAME ## Resize(struct NAME* vector, ssize_t change); \
void NAME ## Shift(struct NAME* vector, size_t location, size_t difference); \
void NAME ## Unshift(struct NAME* vector, size_t location, size_t difference); \
@ -40,6 +41,10 @@
TYPE* NAME ## GetPointer(struct NAME* vector, size_t location) { \
return &vector->vector[location]; \
} \
TYPE* NAME ## Append(struct NAME* vector) { \
NAME ## Resize(vector, 1); \
return &vector->vector[vector->size - 1]; \
} \
void NAME ## Resize(struct NAME* vector, ssize_t change) { \
if (change > 0) { \
NAME ## EnsureCapacity(vector, vector->size + change); \