test "designated inits ideas" { const E = enum { a, b, c, d }; const ss = .{ .{ .a, 10 }, .{ .c, 20 }, .{ .b, 200 }, .{ .d, 255 }, }; inline for (ss) |s| { std.debug.warn("s {}\n", .{s}); } const numSs = std.meta.fields(E).len; std.debug.warn("numSs {}\n", .{numSs}); var arr: [numSs]u8 = undefined; arr[@enumToInt(E.a)] = 10; arr[@enumToInt(E.c)] = 20; arr[@enumToInt(E.b)] = 200; arr[@enumToInt(E.d)] = 255; for (arr) |e, i| { std.debug.warn("{}: {}\n", .{ i, e }); } }