authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-09-13 19:32:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-17 20:12:03-07:00
logc330d2bdde909a199ffff20293974e62454db239
tree258829a080e690e6c343a62d1d0a1a4c2c73b7df
parent92223ad36f4e2103b470b7e32bb2c61bc9e52904

mem.replace: Document that input/output cannot overlap


1 files changed, 1 insertions(+), 0 deletions(-)

lib/std/mem.zig+1
......@@ -3831,6 +3831,7 @@ test rotate {
38313831
38323832/// Replace needle with replacement as many times as possible, writing to an output buffer which is assumed to be of
38333833/// appropriate size. Use replacementSize to calculate an appropriate buffer size.
3834/// The `input` and `output` slices must not overlap.
38343835/// The needle must not be empty.
38353836/// Returns the number of replacements made.
38363837pub fn replace(comptime T: type, input: []const T, needle: []const T, replacement: []const T, output: []T) usize {