Why not just `.vtable = @ptrCast(vtable)`?
Ziggit
Why not just `.vtable = @ptrCast(vtable)`?
I’m getting a grasp of interfaces, and am deeply unwilling to have to write self = @ptrCast(@alignCast(ptr)) all over the place. There MUST be a better way, no? ( See also: https://www.youtube.com/watch?v=2Q8gB2OXB2E ) ( See also (idea of casting the function): Vtable interfaces and the role of @ptrCast and @alignCast - #11 by efjimm ) So I watched the video above that neatly describes Zig interfaces, specifically std.mem.Allocator, and thought to myself: “If I can cast *anyopaque to *T, the...
0 comments
No comments yet.