Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 40 for intSlice (0.25 sec)

  1. src/cmd/compile/internal/test/issue50182_test.go

    	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) {
    	var data = sort.IntSlice{-10, -5, 0, 1, 2, 3, 5, 7, 11, 100, 100, 100, 1000, 10000}
    	f := func() {
    		genericSorted(data)
    	}
    	if n := testing.AllocsPerRun(10, f); n > 0 {
    		t.Errorf("got %f allocs, want 0", n)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 13 23:35:37 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  2. src/internal/types/testdata/examples/functions.go

    // so type inference should be able to handle these cases well.
    
    func g1[T any]([]T) {}
    func g2[T any]([]T, T) {}
    func g3[T any](*T, ...T) {}
    
    func _() {
    	type intSlice []int
    	g1([]int{})
    	g1(intSlice{})
    	g2(nil, 0)
    
    	type myString string
    	var s1 string
    	g3(nil, "1", myString("2"), "3")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 30 20:19:38 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  3. pkg/apis/resource/structured/namedresources/validation/validation_test.go

    		},
    		"bool": {
    			selector: `attributes.bool["name"]`,
    		},
    		"int": {
    			selector: `attributes.int["name"] > 0`,
    		},
    		"intslice": {
    			selector: `attributes.intslice["name"].isSorted()`,
    		},
    		"string": {
    			selector: `attributes.string["name"] == "fish"`,
    		},
    		"stringslice": {
    			selector: `attributes.stringslice["name"].isSorted()`,
    		},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 21:22:13 UTC 2024
    - 10.4K bytes
    - Viewed (0)
  4. src/sort/example_test.go

    	fmt.Println(sort.Float64sAreSorted(s))
    
    	// Output: true
    	// false
    	// false
    }
    
    func ExampleReverse() {
    	s := []int{5, 2, 6, 3, 1, 4} // unsorted
    	sort.Sort(sort.Reverse(sort.IntSlice(s)))
    	fmt.Println(s)
    	// Output: [6 5 4 3 2 1]
    }
    
    func ExampleSlice() {
    	people := []struct {
    		Name string
    		Age  int
    	}{
    		{"Gopher", 7},
    		{"Alice", 55},
    		{"Vera", 24},
    		{"Bob", 75},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 28 17:29:29 UTC 2017
    - 2.8K bytes
    - Viewed (0)
  5. src/cmd/vet/testdata/print/print.go

    	fmt.Println("foo\n")  // ERROR "Println arg list ends with redundant newline"
    	fmt.Println("foo\\n") // not an error
    	fmt.Println(`foo\n`)  // not an error
    
    	intSlice := []int{3, 4}
    	fmt.Printf("%s", intSlice) // ERROR "Printf format %s has arg intSlice of wrong type \[\]int"
    	nonStringerArray := [1]unexportedStringer{{}}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:01 UTC 2023
    - 27.5K bytes
    - Viewed (0)
  6. pkg/apis/resource/structured/namedresources/validation/validation.go

    		}
    		if attribute.BoolValue != nil {
    			entries.Insert("bool")
    		}
    		if attribute.IntValue != nil {
    			entries.Insert("int")
    		}
    		if attribute.IntSliceValue != nil {
    			entries.Insert("intSlice")
    		}
    		if attribute.StringValue != nil {
    			entries.Insert("string")
    		}
    		if attribute.StringSliceValue != nil {
    			entries.Insert("stringSlice")
    		}
    		if attribute.VersionValue != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 21:26:20 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/util/shufflesharding/shufflesharding_test.go

    		maxCount := permutations * int(math.Ceil(nff))
    		aHand := make([]int, test.handSize)
    		for i := 0; i < test.hashMax; i++ {
    			aHand = dealer.DealIntoHand(uint64(i), aHand)
    			sort.IntSlice(aHand).Sort()
    			handCoordinate := 0
    			for _, card := range aHand {
    				handCoordinate = handCoordinate<<7 + card
    			}
    			handCoordinateMap[handCoordinate]++
    		}
    		numHandsSeen := len(handCoordinateMap)
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 25 06:44:08 UTC 2021
    - 6.7K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/ssa/_gen/allocators.go

    	}
    	deriveds := []derived{
    		{
    			name: "BlockSlice",
    			typ:  "[]*Block",
    			base: "ValueSlice",
    		},
    		{
    			name: "IntSlice",
    			typ:  "[]int",
    			base: "Int64Slice",
    		},
    		{
    			name: "Int32Slice",
    			typ:  "[]int32",
    			base: "Int64Slice",
    		},
    		{
    			name: "Int8Slice",
    			typ:  "[]int8",
    			base: "Int64Slice",
    		},
    		{
    			name: "BoolSlice",
    			typ:  "[]bool",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 17 23:34:11 UTC 2023
    - 6.7K bytes
    - Viewed (0)
  9. src/sort/search.go

    func SearchStrings(a []string, x string) int {
    	return Search(len(a), func(i int) bool { return a[i] >= x })
    }
    
    // Search returns the result of applying [SearchInts] to the receiver and x.
    func (p IntSlice) Search(x int) int { return SearchInts(p, x) }
    
    // Search returns the result of applying [SearchFloat64s] to the receiver and x.
    func (p Float64Slice) Search(x float64) int { return SearchFloat64s(p, x) }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 28 16:40:32 UTC 2023
    - 5.7K bytes
    - Viewed (0)
  10. src/runtime/slice_test.go

    	})
    }
    
    var (
    	SinkIntSlice        []int
    	SinkIntPointerSlice []*int
    )
    
    func BenchmarkExtendSlice(b *testing.B) {
    	var length = 4 // Use a variable to prevent stack allocation of slices.
    	b.Run("IntSlice", func(b *testing.B) {
    		s := make([]int, 0, length)
    		for i := 0; i < b.N; i++ {
    			s = append(s[:0:length/2], make([]int, length)...)
    		}
    		SinkIntSlice = s
    	})
    	b.Run("PointerSlice", func(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 17 09:45:44 UTC 2020
    - 10.3K bytes
    - Viewed (0)
Back to top