Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 487 for Slice3 (0.32 sec)

  1. test/slice3.go

    			return -1, false
    		}
    		isconst = true
    		if s[0] == 'v' {
    			isconst = false
    			s = s[1:]
    		}
    		n, _ = strconv.Atoi(s)
    		return n, isconst
    	}
    
    	const Cap = 10 // cap of slice, array
    
    	for _, base := range []string{"array", "slice"} {
    		for _, i := range index {
    			iv, iconst := parse(i)
    			for _, j := range index {
    				jv, jconst := parse(j)
    				for _, k := range index {
    					kv, kconst := parse(k)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 2.9K bytes
    - Viewed (0)
  2. test/escape_slice.go

    }
    
    func slice2() []*int {
    	var s []*int
    	i := 0 // ERROR "moved to heap: i"
    	s = append(s, &i)
    	return s
    }
    
    func slice3() *int {
    	var s []*int
    	i := 0 // ERROR "moved to heap: i"
    	s = append(s, &i)
    	for _, p := range s {
    		return p
    	}
    	return nil
    }
    
    func slice4(s []*int) { // ERROR "s does not escape"
    	i := 0 // ERROR "moved to heap: i"
    	s[0] = &i
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 18:50:24 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  3. src/go/types/index.go

    		if x.mode != variable {
    			check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s (value not addressable)", x)
    			x.mode = invalid
    			return
    		}
    		x.typ = &Slice{elem: u.elem}
    
    	case *Pointer:
    		if u, _ := under(u.base).(*Array); u != nil {
    			valid = true
    			length = u.len
    			x.typ = &Slice{elem: u.elem}
    		}
    
    	case *Slice:
    		valid = true
    		// x.typ doesn't change
    	}
    
    	if !valid {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 16:17:05 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  4. tests/upsert_test.go

    }
    
    func TestUpsertSlice(t *testing.T) {
    	langs := []Language{
    		{Code: "upsert-slice1", Name: "Upsert-slice1"},
    		{Code: "upsert-slice2", Name: "Upsert-slice2"},
    		{Code: "upsert-slice3", Name: "Upsert-slice3"},
    	}
    	DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&langs)
    
    	var langs2 []Language
    	if err := DB.Find(&langs2, "code LIKE ?", "upsert-slice%").Error; err != nil {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Sep 05 07:39:19 UTC 2022
    - 11.4K bytes
    - Viewed (0)
  5. src/go/types/exprstring.go

    	case *ast.SliceExpr:
    		WriteExpr(buf, x.X)
    		buf.WriteByte('[')
    		if x.Low != nil {
    			WriteExpr(buf, x.Low)
    		}
    		buf.WriteByte(':')
    		if x.High != nil {
    			WriteExpr(buf, x.High)
    		}
    		if x.Slice3 {
    			buf.WriteByte(':')
    			if x.Max != nil {
    				WriteExpr(buf, x.Max)
    			}
    		}
    		buf.WriteByte(']')
    
    	case *ast.TypeAssertExpr:
    		WriteExpr(buf, x.X)
    		buf.WriteString(".(")
    		WriteExpr(buf, x.Type)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 19:31:44 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  6. src/reflect/all_test.go

    	}
    	if !DeepEqual(v[0:4], xs[3:7:7]) {
    		t.Errorf("xs.Slice3(3, 5, 7)[0:4] = %v", v[0:4])
    	}
    	rv := ValueOf(&xs).Elem()
    	shouldPanic("Slice3", func() { rv.Slice3(1, 2, 1) })
    	shouldPanic("Slice3", func() { rv.Slice3(1, 1, 11) })
    	shouldPanic("Slice3", func() { rv.Slice3(2, 2, 1) })
    
    	xa := [8]int{10, 20, 30, 40, 50, 60, 70, 80}
    	v = ValueOf(&xa).Elem().Slice3(2, 5, 6).Interface().([]int)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 218.8K bytes
    - Viewed (0)
  7. test/escape_reflect.go

    func slice1(x []byte) []byte { // ERROR "leaking param: x$"
    	v := reflect.ValueOf(x) // ERROR "x escapes to heap"
    	return v.Slice(1, 2).Bytes()
    }
    
    // Unfortunate: x doesn't need to escape to heap, just to result.
    func slice2(x string) string { // ERROR "leaking param: x$"
    	v := reflect.ValueOf(x) // ERROR "x escapes to heap"
    	return v.Slice(1, 2).String()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 18:50:24 UTC 2023
    - 13.1K bytes
    - Viewed (0)
  8. src/go/parser/parser.go

    	if ncolons > 0 {
    		// slice expression
    		slice3 := false
    		if ncolons == 2 {
    			slice3 = true
    			// Check presence of middle and final index here rather than during type-checking
    			// to prevent erroneous programs from passing through gofmt (was go.dev/issue/7305).
    			if index[1] == nil {
    				p.error(colons[0], "middle index required in 3-index slice")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 08 20:07:50 UTC 2023
    - 72.2K bytes
    - Viewed (0)
  9. src/text/template/funcs.go

    		}
    	}
    	return item, nil
    }
    
    // Slicing.
    
    // slice returns the result of slicing its first argument by the remaining
    // arguments. Thus "slice x 1 2" is, in Go syntax, x[1:2], while "slice x"
    // is x[:], "slice x 1" is x[1:], and "slice x 1 2 3" is x[1:2:3]. The first
    // argument must be a string, slice, or array.
    func slice(item reflect.Value, indexes ...reflect.Value) (reflect.Value, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 22:23:55 UTC 2024
    - 20.9K bytes
    - Viewed (0)
  10. src/reflect/value.go

    }
    
    // Slice3 is the 3-index form of the slice operation: it returns v[i:j:k].
    // It panics if v's Kind is not [Array] or [Slice], or if v is an unaddressable array,
    // or if the indexes are out of bounds.
    func (v Value) Slice3(i, j, k int) Value {
    	var (
    		cap  int
    		typ  *sliceType
    		base unsafe.Pointer
    	)
    	switch kind := v.kind(); kind {
    	default:
    		panic(&ValueError{"reflect.Value.Slice3", v.kind()})
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:17:41 UTC 2024
    - 119.9K bytes
    - Viewed (0)
Back to top