std: add ArrayList.eql for parity with std.Buffer

This commit is contained in:
daurnimator 2020-02-07 14:20:21 +11:00 committed by Andrew Kelley
parent 119ac13eda
commit fd23decbd9
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -249,6 +249,10 @@ pub fn AlignedArrayList(comptime T: type, comptime alignment: ?u29) type {
return self.pop();
}
pub fn eql(self: Self, m: []const T) bool {
return mem.eql(T, self.toSliceConst(), m);
}
pub fn startsWith(self: Self, m: []const T) bool {
if (self.len < m.len) return false;
return mem.eql(T, self.items[0..m.len], m);