Given a function: func F[T comparable](a T) { }
is it possible to check T's type inside F? My use case is that I have a function with signature G[T comparable](x []T) and inside G I want to sort the elements in slice x where T could be int or string. This arises in a tiny generic set module I've created: https://github.com/mark-summerfield/gset In the String() method I want to return a string with the elements sorted (for human readability and for testing convenience); but at the moment I can only do this by converting all elements to strings and sorting them which isn't good for ints. -- 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/e746f065-24fa-474a-90ec-2d8367bf3e3bn%40googlegroups.com.