authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-03-13 19:42:41 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-03-13 19:42:41 -07:00
log3f0f0b7f34922ccc63d2a8e12b4b9d2c8754218c
treeabfd9246490b362f874b4bf2f5d61df3a7b9e5ce
parent5be076d136ee82ec02fe12278ae182cba8482b72
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add Pointee


2 files changed, 17 insertions(+), 0 deletions(-)

src/Pointee.zig created+16
......@@ -0,0 +1,16 @@
1const std = @import("std");
2const extras = @import("./lib.zig");
3
4pub fn Pointee(T: type) type {
5 return switch (@typeInfo(T)) {
6 .pointer => |p| p.child,
7 else => T,
8 };
9}
10
11test {
12 try std.testing.expect(Pointee(u8) == u8);
13}
14test {
15 try std.testing.expect(Pointee(*u8) == u8);
16}
src/lib.zig+1
......@@ -120,3 +120,4 @@ pub usingnamespace @import("./compareFnRange.zig");
120120pub usingnamespace @import("./asciiLower.zig");
121121pub usingnamespace @import("./parseDigits.zig");
122122pub usingnamespace @import("./from_hex.zig");
123pub usingnamespace @import("./Pointee.zig");