On Tue, Nov 8, 2022 at 9:53 AM 'Mark' via golang-nuts
<golang-nuts@googlegroups.com> wrote:

> 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.

https://go.dev/play/p/zxQYVvOMX35 ?

-- 
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/CAA40n-Xei-qGr149VjURsfKOp42THVTBowGeFxHY_bdwowYMmQ%40mail.gmail.com.

Reply via email to