tbolwerk/dynamic_array ? reverse-engineered prompt
Reverse engineered prompt
Build me a single header C library for a generic dynamic array that I can just copy into a project and include with one line.
I want it to feel easy to use, so I can declare an array for different types, push and pop values, read items with normal indexing, and get the count and capacity. It should grow automatically, clean itself up when it goes out of scope, and handle empty pops safely. Please also add sorting and searching for basic numeric types, plus simple helper macros for looping through items, mapping, filtering, and reducing arrays.
I’d like a small print helper too, so common types like ints, floats, doubles, and strings can be printed with the right format automatically. If possible, make debug builds log when memory is freed, and keep error handling simple by printing to stderr and exiting on allocation failure. If you need to, look up current docs online for any compiler specific details.
Are you gonna build this?
make sure you review the code using coderabbit