is it mentioned anywhere such that "map[string]struct{}" is efficeient?
On Tuesday, April 28, 2020 at 10:23:08 AM UTC+5:30, Randall O'Reilly wrote: > > I think map[string]struct{} takes no storage for the value and is the most > efficient way to do this. > > - Randy > > > On Apr 27, 2020, at 7:20 PM, Shishir Verma <shish...@gmail.com > <javascript:>> wrote: > > > > I think the idiomatic way to implement a set in golang is to use a map > with bool values. Here is an example from effective go documentation: > > > > > > attended := map[string]bool{ > > "Ann": true, > > "Joe": true, > > ... > > } > > > > if attended[person] { // will be false if person is not in the map > > fmt.Println(person, "was at the meeting") > > } > > > > > > > > On Monday, 27 April 2020 22:16:20 UTC+5:30, adithya...@gmail.com wrote: > > Basically i need a slice with indexed values, so that i can check only > existence. > > or a map with only keys? > > How it can be done? > > > > -- > > You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to golan...@googlegroups.com <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/1201e6f3-621e-4875-9374-d7713fa7d8aa%40googlegroups.com. > > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/267feb65-6068-444d-82fb-fa7976bfaace%40googlegroups.com.