aboutsummaryrefslogtreecommitdiff
path: root/set.go
blob: 760c9ae11a97a51a55a73f48149782ce151d6b43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package main

type Set[T comparable] map[T]bool

func (s Set[T]) Contain(val T) bool {
	_, ok := s[val]
	return ok
}

func (s Set[T]) Insert(val T) {
	s[val] = true
}

func (s Set[T]) Erase(val T) {
	delete(s, val)
}