| 1 | const std = @import("std"); |
| 2 | const extras = @import("./lib.zig"); |
| 3 | |
| 4 | pub fn Pointee(T: type) type { |
| 5 | return switch (@typeInfo(T)) { |
| 6 | .pointer => |p| p.child, |
| 7 | else => T, |
| 8 | }; |
| 9 | } |
| 10 | |
| 11 | test { |
| 12 | try std.testing.expect(Pointee(u8) == u8); |
| 13 | } |
| 14 | test { |
| 15 | try std.testing.expect(Pointee(*u8) == u8); |
| 16 | } |