aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-05-11 22:21:22 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2021-05-11 22:22:21 +0200
commitc0369575218d3dccb69f62495de31c8e22d41ae9 (patch)
tree6f5f3cb32c6886f0dcd7400d6507c1fd6ffd03d0 /lib/std/meta.zig
parentace5714551da16b541d8015e97a2fe32a7a1cf76 (diff)
downloadzig-c0369575218d3dccb69f62495de31c8e22d41ae9.tar.gz
zig-c0369575218d3dccb69f62495de31c8e22d41ae9.zip
std.meta.Elem: support all optional types
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 391b7259e3..473d4fcf26 100644
--- 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) ++ "'");