v
v copied to clipboard
map and Set does not support arbitrary keys
map currently only supports basic types (int, string, ...) as keys.
A custom struct is not supported as keys. Example:
struct PersonalInfo {
name string
age int
}
mut info_map := map[PersonalInfo]int{}
gives this error
cgen error: map key type not supported
Set<T> also uses map behind the scenes and is indirectly affected.
see discussion https://github.com/vlang/v/discussions/11927