this post was submitted on 11 Mar 2024
2 points (100.0% liked)

Zig Programming Language

168 readers
3 users here now

A lemm.ee community for Zig!

founded 1 year ago
MODERATORS
 

From the README:

A gap buffer is like a std.ArrayList, except that rather than having one contiguous block of items, there are two, with a moveable “gap” between them. Although moving the gap requires a copy, insertions and deletions at either side of the gap become O(1) operations.

This repository implements managed, unmanaged and optionally aligned versions of GapBuffer(T). The API is directly inspired by std.ArrayList. The main differences are “Before” and “After” versions of operations that operate or affect the gap—“Before” operations will add or remove elements before the gap. There are also convenience functions for translating a “logical” index into an offset, an element, or a pointer from the buffer, allowing the user to be largely agnostic about the location of the gap.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here