codekingpro/portable-devtools
114k
1// compile2 3// Copyright 2022 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7package main8 9type Addr struct {10 hi uint6411 lo uint6412 z *byte13}14 15func EqualMap[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool {16 for k, v1 := range m1 {17 if v2, ok := m2[k]; !ok || v1 != v2 {18 return false19 }20 }21 return true22}23 24type Set[T comparable] map[T]struct{}25 26func NewSet[T comparable](items ...T) Set[T] {27 return nil28}29 30func (s Set[T]) Equals(other Set[T]) bool {31 return EqualMap(s, other)32}33 34func main() {35 NewSet[Addr](Addr{0, 0, nil})36}37 