fn CAST_OR_CALL(a: anytype, b: anytype) switch (@typeInfo(@TypeOf(a))) { .Type => a, .Fn => |fn_info| fn_info.return_type orelse void, else => |info| @compileError("Unexpected argument type: " ++ @tagName(info)), }
[src]
A 2-argument function-like macro defined as #define FOO(A, B) (A)(B) could be either: cast B to A, or call A with the value B.