403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/go/src/go/parser/testdata/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/go/src/go/parser/testdata/sort.go2
package sort

type orderedSlice[Elem comparable] []Elem

func (s orderedSlice[Elem]) Len() int           { return len(s) }
func (s orderedSlice[Elem]) Less(i, j int) bool { return s[i] < s[j] }
func (s orderedSlice[Elem]) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }

// OrderedSlice sorts the slice s in ascending order.
// The elements of s must be ordered using the < operator.
func OrderedSlice[Elem comparable](s []Elem) {
	sort.Sort(orderedSlice[Elem](s))
}

type sliceFn[Elem any] struct {
	s []Elem
	f func(Elem, Elem) bool
}

func (s sliceFn[Elem]) Len() int           { return len(s.s) }
func (s sliceFn[Elem]) Less(i, j int) bool { return s.f(s.s[i], s.s[j]) }
func (s sliceFn[Elem]) Swap(i, j int)      { s.s[i], s.s[j] = s.s[j], s.s[i] }

// SliceFn sorts the slice s according to the function f.
func SliceFn[Elem any](s []Elem, f func(Elem, Elem) bool) {
	Sort(sliceFn[Elem]{s, f})
}

Youez - 2016 - github.com/yon3zu
LinuXploit