align(@alignOf(T)) T does not force resolution of T

This commit is contained in:
Andrew Kelley
2019-08-30 14:53:44 -04:00
parent 966670645a
commit d9fed5cdfd
4 changed files with 77 additions and 24 deletions

View File

@@ -10,6 +10,11 @@ pub fn ArrayList(comptime T: type) type {
}
pub fn AlignedArrayList(comptime T: type, comptime alignment: ?u29) type {
if (alignment) |a| {
if (a == @alignOf(T)) {
return AlignedArrayList(T, null);
}
}
return struct {
const Self = @This();