Util: Add Vector GetConstPointer

This commit is contained in:
Jeffrey Pfau 2016-08-19 05:05:30 -07:00
parent 2e55bd098a
commit 947ef7edea
2 changed files with 5 additions and 0 deletions

View File

@ -61,6 +61,7 @@ Misc:
- GBA Video: Optimize mode 0 rendering - GBA Video: Optimize mode 0 rendering
- Qt: Remove default autofire mappings - Qt: Remove default autofire mappings
- PSP2: Allow UTF-8 filenames - PSP2: Allow UTF-8 filenames
- Util: Add Vector GetConstPointer
0.4.1: (2016-07-11) 0.4.1: (2016-07-11)
Bugfixes: Bugfixes:

View File

@ -17,6 +17,7 @@
void NAME ## Init(struct NAME* vector, size_t capacity); \ void NAME ## Init(struct NAME* vector, size_t capacity); \
void NAME ## Deinit(struct NAME* vector); \ void NAME ## Deinit(struct NAME* vector); \
TYPE* NAME ## GetPointer(struct NAME* vector, size_t location); \ TYPE* NAME ## GetPointer(struct NAME* vector, size_t location); \
TYPE const* NAME ## GetConstPointer(const struct NAME* vector, size_t location); \
TYPE* NAME ## Append(struct NAME* vector); \ TYPE* NAME ## Append(struct NAME* vector); \
void NAME ## Clear(struct NAME* vector); \ void NAME ## Clear(struct NAME* vector); \
void NAME ## Resize(struct NAME* vector, ssize_t change); \ void NAME ## Resize(struct NAME* vector, ssize_t change); \
@ -43,6 +44,9 @@
TYPE* NAME ## GetPointer(struct NAME* vector, size_t location) { \ TYPE* NAME ## GetPointer(struct NAME* vector, size_t location) { \
return &vector->vector[location]; \ return &vector->vector[location]; \
} \ } \
TYPE const* NAME ## GetConstPointer(const struct NAME* vector, size_t location) { \
return &vector->vector[location]; \
} \
TYPE* NAME ## Append(struct NAME* vector) { \ TYPE* NAME ## Append(struct NAME* vector) { \
NAME ## Resize(vector, 1); \ NAME ## Resize(vector, 1); \
return &vector->vector[vector->size - 1]; \ return &vector->vector[vector->size - 1]; \