fn ensureAliasAwareCapacity(r: *Managed, needed: usize, aliased: bool) !void
When aliased is false (including when both pointers refer to the same object), ensureCapacity may reallocate; callers who rely on distinct Managed instances aliasing must ensure capacity before aliasing. See https://github.com/ziglang/zig/issues/6167
aliased
ensureCapacity
Managed
r: *Managed
needed: usize
aliased: bool
3331 3332 3333 3334 3335 3336 3337
fn ensureAliasAwareCapacity(r: *Managed, needed: usize, aliased: bool) !void { if (aliased) { assert(needed <= r.limbs.len); } else { try r.ensureCapacity(needed); } }
When
aliasedis false (including when both pointers refer to the same object),ensureCapacitymay reallocate; callers who rely on distinctManagedinstances aliasing must ensure capacity before aliasing. See https://github.com/ziglang/zig/issues/6167