On Friday, September 23, 2016 at 12:30:36 AM UTC-4, Dave Cheney wrote: > > There are two ways, one is to use reflection, the other would be to use > unsafe to convert the slice value into another structure then extract the > length field. > > Assuming that you could write a Len function as you specified, what would > you do next? What problem are you trying to solve? >
Ok, I'm sorry for not stating actual problem. I'm trying to remove duplicates from slices (of various types, strings, int, float is enough for now). This requires me to create a map from that type to boolean, for example, as part of the algorithm. I cannot figure out how to make such a function work for all types (note I'm coming from C++ and Java where I knew how to do this). -- 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. For more options, visit https://groups.google.com/d/optout.