authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-18 23:52:41 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-18 23:52:41 -08:00
log518ffdd4b7e14c00aac078f9d19991de5b43b68a
treefc8fd176d26b4d05b26d33a9198d716eb1378ba1
parent1775b61ec4a6676719a8c369e56af7f183bd303a

StructOfArrays: support tuples


1 files changed, 3 insertions(+), 2 deletions(-)

src/StructOfArrays.zig+3-2
......@@ -4,7 +4,8 @@ const extras = @import("./lib.zig");
44const expectSimilarType = extras.expectSimilarType;
55
66pub fn StructOfArrays(len: usize, T: type) type {
7 const fields = std.meta.fields(T);
7 const info = @typeInfo(T).@"struct";
8 const fields = info.fields;
89 var new_fields: [fields.len]std.builtin.Type.StructField = undefined;
910 for (fields, 0..) |item, i| {
1011 new_fields[i] = .{
......@@ -21,7 +22,7 @@ pub fn StructOfArrays(len: usize, T: type) type {
2122 .backing_integer = null,
2223 .fields = result,
2324 .decls = &.{},
24 .is_tuple = false,
25 .is_tuple = info.is_tuple,
2526 }));
2627}
2728