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");...@@ -4,7 +4,8 @@ const extras = @import("./lib.zig");
4const expectSimilarType = extras.expectSimilarType;4const expectSimilarType = extras.expectSimilarType;
55
6pub fn StructOfArrays(len: usize, T: type) type {6pub 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;
8 var new_fields: [fields.len]std.builtin.Type.StructField = undefined;9 var new_fields: [fields.len]std.builtin.Type.StructField = undefined;
9 for (fields, 0..) |item, i| {10 for (fields, 0..) |item, i| {
10 new_fields[i] = .{11 new_fields[i] = .{
...@@ -21,7 +22,7 @@ pub fn StructOfArrays(len: usize, T: type) type {...@@ -21,7 +22,7 @@ pub fn StructOfArrays(len: usize, T: type) type {
21 .backing_integer = null,22 .backing_integer = null,
22 .fields = result,23 .fields = result,
23 .decls = &.{},24 .decls = &.{},
24 .is_tuple = false,25 .is_tuple = info.is_tuple,
25 }));26 }));
26}27}
2728