#Unable to infer array size if I don't repeat it twice
1 messages · Page 1 of 1 (latest)
foos: [ELEM_COUNT]?Foo = @splat(null),
Thanks!
Actually another related question; this is an element of another struct Bar:
const Bar = struct {
foos: [ELEM_COUNT]?Foo = @splat(null),
};
how can I initialize a Bar with only one Foo without using ELEM_COUNT?
const bar = Bar{
foos[0] ??? = .{...},
}
const bar = blk: {
var bar: Bar = .{ .foos = @splat(null) };
bar.foos[0] = something_else;
break :blk bar;
};
So it's impossible in an initializer?
Yeah, very flexible