zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

struct_name.zig (362B) - Raw


      1 const std = @import("std");
      2 
      3 pub fn main() void {
      4     const Foo = struct {};
      5     std.debug.print("variable: {s}\n", .{@typeName(Foo)});
      6     std.debug.print("anonymous: {s}\n", .{@typeName(struct {})});
      7     std.debug.print("function: {s}\n", .{@typeName(List(i32))});
      8 }
      9 
     10 fn List(comptime T: type) type {
     11     return struct {
     12         x: T,
     13     };
     14 }
     15 
     16 // exe=succeed