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.