mirror of
https://github.com/ziglang/zig.git
synced 2026-02-18 15:31:48 +00:00
std.meta.Elem: support all optional types
This commit is contained in:
parent
ace5714551
commit
c036957521
@ -175,13 +175,7 @@ pub fn Elem(comptime T: type) type {
|
||||
},
|
||||
.Many, .C, .Slice => return info.child,
|
||||
},
|
||||
.Optional => |info| switch (@typeInfo(info.child)) {
|
||||
.Pointer => |ptr_info| switch (ptr_info.size) {
|
||||
.Many => return ptr_info.child,
|
||||
else => {},
|
||||
},
|
||||
else => {},
|
||||
},
|
||||
.Optional => |info| return Elem(info.child),
|
||||
else => {},
|
||||
}
|
||||
@compileError("Expected pointer, slice, array or vector type, found '" ++ @typeName(T) ++ "'");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user