Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 1,614 for qsort (0.04 sec)

  1. src/cmd/compile/internal/test/testdata/mysort/mysort.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Generic sort function, tested with two different pointer types.
    
    package mysort
    
    import (
    	"fmt"
    )
    
    type LessConstraint[T any] interface {
    	Less(T) bool
    }
    
    //go:noinline
    func Sort[T LessConstraint[T]](x []T) {
    	n := len(x)
    	for i := 1; i < n; i++ {
    		for j := i; j > 0 && x[j].Less(x[j-1]); j-- {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 12 20:53:52 UTC 2021
    - 762 bytes
    - Viewed (0)
  2. src/go/doc/testdata/examples/multiple.go

    // people is the array of Person
    var people = []Person{
    	{"Bob", 31},
    	{"John", 42},
    	{"Michael", 17},
    	{"Jenny", 26},
    }
    
    func ExampleSort() {
    	fmt.Println(people)
    	sort.Sort(ByAge(people))
    	fmt.Println(people)
    	// Output:
    	// [Bob: 31 John: 42 Michael: 17 Jenny: 26]
    	// [Michael: 17 Jenny: 26 Bob: 31 John: 42]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 10 16:17:51 UTC 2022
    - 1.7K bytes
    - Viewed (0)
  3. pkg/apis/flowcontrol/util/helpers.go

    limitations under the License.
    */
    
    package util
    
    import (
    	"sort"
    
    	"k8s.io/kubernetes/pkg/apis/flowcontrol"
    )
    
    var _ sort.Interface = FlowSchemaSequence{}
    
    // FlowSchemaSequence holds sorted set of pointers to FlowSchema objects.
    // FlowSchemaSequence implements `sort.Interface`
    type FlowSchemaSequence []*flowcontrol.FlowSchema
    
    func (s FlowSchemaSequence) Len() int {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Oct 29 04:26:12 UTC 2019
    - 1.2K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/test/issue50182_test.go

    package test
    
    import (
    	"fmt"
    	"sort"
    	"testing"
    )
    
    // Test that calling methods on generic types doesn't cause allocations.
    func genericSorted[T sort.Interface](data T) bool {
    	n := data.Len()
    	for i := n - 1; i > 0; i-- {
    		if data.Less(i, i-1) {
    			return false
    		}
    	}
    	return true
    }
    func TestGenericSorted(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 13 23:35:37 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  5. istioctl/pkg/util/configdump/route.go

    		drc[i].RouteConfig.TypeUrl = v3.RouteType
    	}
    	sort.Slice(drc, func(i, j int) bool {
    		r := &route.RouteConfiguration{}
    		err = drc[i].RouteConfig.UnmarshalTo(r)
    		if err != nil {
    			return false
    		}
    		name := r.Name
    		err = drc[j].RouteConfig.UnmarshalTo(r)
    		if err != nil {
    			return false
    		}
    		return name < r.Name
    	})
    
    	// In Istio 1.5, it is not enough just to sort the routes.  The virtual hosts
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Nov 03 08:41:32 UTC 2022
    - 3.2K bytes
    - Viewed (0)
  6. pkg/volume/util/volumeattributesclass.go

    			klog.V(4).Infof("GetDefaultVolumeAttributesClass added: %s", class.Name)
    		}
    	}
    
    	if len(defaultClasses) == 0 {
    		return nil, nil
    	}
    
    	// Primary sort by creation timestamp, newest first
    	// Secondary sort by class name, ascending order
    	sort.Slice(defaultClasses, func(i, j int) bool {
    		if defaultClasses[i].CreationTimestamp.UnixNano() == defaultClasses[j].CreationTimestamp.UnixNano() {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Oct 31 03:18:56 UTC 2023
    - 2.6K bytes
    - Viewed (0)
  7. pkg/config/analysis/diag/messages.go

    package diag
    
    import (
    	"sort"
    )
    
    // Messages is a slice of Message items.
    type Messages []Message
    
    // Add a new message to the messages
    func (ms *Messages) Add(m ...Message) {
    	*ms = append(*ms, m...)
    }
    
    // Sort the message lexicographically by level, code, resource origin name, then string.
    func (ms *Messages) Sort() {
    	sort.Slice(*ms, func(i, j int) bool {
    		a, b := (*ms)[i], (*ms)[j]
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 02:47:46 UTC 2023
    - 2.6K bytes
    - Viewed (0)
  8. platforms/documentation/docs/src/snippets/configurationCache/topLevel/groovy/build.gradle

    def listFiles(File dir) {
        dir.listFiles({ file -> file.isFile() } as FileFilter).name.sort()
    }
    
    tasks.register('listFiles') {
        doLast {
            println listFiles(dir)
        }
    }
    // end::not-supported[]
    
    // tag::workaround[]
    class Files {
        static def listFiles(File dir) {
            dir.listFiles({ file -> file.isFile() } as FileFilter).name.sort()
        }
    }
    
    tasks.register('listFilesFixed') {
        doLast {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Mon Nov 27 17:53:42 UTC 2023
    - 567 bytes
    - Viewed (0)
  9. src/cmd/compile/internal/ssa/cache.go

    	hdrInt64Slice []*[]int64
    }
    
    func (c *Cache) Reset() {
    	nv := sort.Search(len(c.values), func(i int) bool { return c.values[i].ID == 0 })
    	xv := c.values[:nv]
    	for i := range xv {
    		xv[i] = Value{}
    	}
    	nb := sort.Search(len(c.blocks), func(i int) bool { return c.blocks[i].ID == 0 })
    	xb := c.blocks[:nb]
    	for i := range xb {
    		xb[i] = Block{}
    	}
    	nl := sort.Search(len(c.locs), func(i int) bool { return c.locs[i] == nil })
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 15 23:00:54 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  10. subprojects/diagnostics/src/test/groovy/org/gradle/api/tasks/diagnostics/internal/insight/DependencyResultSorterSpec.groovy

            new DefaultMutableVersionConstraint(version)
        }
    
        def "throws exception if dependency or requested component selector is null (#d1, #d2)"() {
            when:
            DependencyResultSorter.sort([d1, d2], versionSelectorScheme, versionComparator, versionParser)
    
            then:
            Throwable t = thrown(IllegalArgumentException)
            t.message == "Dependency edge or the requested component selector may not be null"
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Nov 04 22:26:51 UTC 2021
    - 18.6K bytes
    - Viewed (0)
Back to top