A proper map based set is a map[type]void or whatever golang has for void.
Can you give me an example, I'm curious to know :)
_, ok := m[thing_to_be_found]
So it doesn't matter what you put in there, including struct{}.EDIT: Now I still need to create an empty struct to use as a value when something is found, which is a bit less elegant in my eyes.
var dummy struct{}
found[key] = dummy
But that might just be taste, when reading it, the fact that it's a boolean value saying "found = true" just takes no overhead in parsing the meaning.Thanks guys ;-)
found[key] = struct{}{}