refactor(base): 通过 typeof 为 array_push 宏添加返回类型推导

This commit is contained in:
2026-05-17 03:11:15 +08:00
parent 9663097a98
commit 74be362b1f

View File

@@ -100,7 +100,9 @@ array_erase_impl(void *items, size_t item_size, size_t *count, size_t index) {
/** @brief 为具体类型数组追加一个槽位。 */ /** @brief 为具体类型数组追加一个槽位。 */
#define array_push(items, count, capacity) \ #define array_push(items, count, capacity) \
array_push_impl((void **)&(items), sizeof(*(items)), &(count), &(capacity)) ( \
typeof(items) \
)array_push_impl((void **)&(items), sizeof(*(items)), &(count), &(capacity))
/** @brief 删除具体类型数组中指定下标的元素。 */ /** @brief 删除具体类型数组中指定下标的元素。 */
#define array_erase(items, count, index) \ #define array_erase(items, count, index) \