#How to compare string types in a more lenient way?

1 messages · Page 1 of 1 (latest)

low rover
#

So I have this code but the type system is too strict, I want to allow all *const [n:0]u8 but it only works when you specify a length and the sentinel value like *const [3:0]u8 in this case.
https://godbolt.org/z/aT8a5cff9

fierce cedar
gentle anvil
#

just cast to []const u8 and let the compiler generate the error

low rover
#

mk

gentle anvil
#

but if you did want to check, std.meta.Elem(field.field_type) == u8 gets you pretty close

low rover
gentle anvil
#

just column[i].name = column_names[i];