commit c0369575218d3dccb69f62495de31c8e22d41ae9 (tree)
parent ace5714551da16b541d8015e97a2fe32a7a1cf76
Author: Isaac Freund <ifreund@ifreund.xyz>
Date: Tue, 11 May 2021 22:21:22 +0200
std.meta.Elem: support all optional types
Diffstat:
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
@@ -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) ++ "'");