github.com/searKing/golang/go@v1.2.117/exp/maps/set.go (about) 1 // Copyright 2022 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package maps 6 7 // Set implements a non-thread safe Set 8 func Set[M map[K]struct{}, K comparable](ks ...K) (m M) { 9 m = make(M, len(ks)) 10 for _, k := range ks { 11 m[k] = struct{}{} 12 } 13 return m 14 }