Dynamic Lists with ArrayList
Grow a buffer backed by an allocator.
A Growable Buffer
Sometimes you do not know the size up front. std.ArrayList is a dynamic array that grows as you add items, backed by an allocator. 📈
It Is Generic
ArrayList is a generic type: you name the element type once, and you get a list of exactly that type with full type safety.
const List = std.ArrayList(i32);All lessons in this course
- Why Zig Has No Hidden Allocations
- The Allocator Interface
- alloc, free, create, destroy
- Dynamic Lists with ArrayList