3 ms·
How does Zig represent Option<Option<i32>>? Would it be something like this? ??i32
by wtetzner 4y ago
How does Zig represent Option<Option<i32>>? Would it be something like this?
??i32
- flohofwoe 4y agoI had to try it out first, but yep, that's how it works: const assert = @import("std").debug.assert; fn get12() i32 { const opt_opt_val: ??i32 = 12; const val = opt_opt_val.?.?; comptime assert(val == 12); return val; } [https://www.godbolt.org/z/oncd5shvP https://www.godbolt.org/z/oncd5shvP]