aboutsummaryrefslogtreecommitdiffstats
path: root/include/container.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/container.h')
-rw-r--r--include/container.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/container.h b/include/container.h
index 1401162..5f40e4a 100644
--- a/include/container.h
+++ b/include/container.h
@@ -130,6 +130,8 @@ typedef void*(*memcpy_t)(void* restrict, const void*, size_t);
} while(0)
/* Removes last element from the array */
#define array_pop(array) --array_header(array)->size
+/* get last element of an array */
+#define array_last(array) (array)[array_header((array))->size - 1]
/* Reserve length elements so that subsequent (length - current_size) pushes require no reallocation */
#define array_reserve(array, length) do { array = _memreserve_dynarray(array, length); } while (0)
/* Change size of an array. the capacity is set to lowest power of 2 that is greater than length */