A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/google/go-cmp/issues/365 below:

SortSlice s and SortMaps should accept func(T,T) int signature · Issue #365 · google/go-cmp · GitHub

The stdlib is gradually coalescing around func(T, T) int over func(T, T) bool as the function to compare elements. See slices.CompareFunc for example.

For better or worse, the cmpopts.SortSlices and cmpopts.SortMaps uses Go reflection to call an arbitrary function (since it predates the introduction of Go generics). One benefit of the non-generic API is that we can support both a "less"-like function and a "compare"-like function.

\cc @icio


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4