Right now as I understand it, I would still have to write a different
generic function for different length arrays, or one that accepted slices.
as per:
// Accept slices of T
func someSliceFunc(type T)(s []T){ ... }
// Accept a 1 member array of T
func someArrayFunc(type T)(a [1]T){ ... }
...
// For what ever number of specific length arrays you wish to support.
func someBiggerArrayFunc(type T)(a [???]T){ ... }
It would be nice to indicate the generic function accepts any length of
array as well as slices, something like:
// Accept any length of array or slice of T
func someFunc(type T)(a [...]T){ ... }
Where the [...] indicates the function works with any length array or a
slice.
Russell
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/f70ef878-622a-4b8e-94ca-40331df866e9o%40googlegroups.com.