Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,399 for slice6 (0.15 sec)

  1. 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)
  2. pkg/slices/slices.go

    // limitations under the License.
    
    // Package slices defines various functions useful with slices of any type.
    package slices
    
    import (
    	"cmp"
    	"slices" // nolint: depguard
    	"strings"
    
    	"golang.org/x/exp/constraints"
    )
    
    // Equal reports whether two slices are equal: the same length and all
    // elements equal. If the lengths are different, Equal returns false.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 15 06:28:11 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  3. test/codegen/slices.go

    }
    
    // --------------------------------------- //
    //   Code generation for unsafe.Slice      //
    // --------------------------------------- //
    
    func Slice1(p *byte, i int) []byte {
    	// amd64:-"MULQ"
    	return unsafe.Slice(p, i)
    }
    func Slice0(p *struct{}, i int) []struct{} {
    	// amd64:-"MULQ"
    	return unsafe.Slice(p, i)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 23 18:57:27 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  4. src/sort/slice.go

    //
    // Note: in many situations, the newer [slices.SortFunc] function is more
    // ergonomic and runs faster.
    func Slice(x any, less func(i, j int) bool) {
    	rv := reflectlite.ValueOf(x)
    	swap := reflectlite.Swapper(x)
    	length := rv.Len()
    	limit := bits.Len(uint(length))
    	pdqsort_func(lessSwap{less, swap}, 0, length, limit)
    }
    
    // SliceStable sorts the slice x using the provided less
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 28 16:40:32 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/testdata/slices.go

    // Copyright 2019 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package slices implements various slice algorithms.
    package slices
    
    // Map turns a []T1 to a []T2 using a mapping function.
    func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {
    	r := make([]T2, len(s))
    	for i, v := range s {
    		r[i] = f(v)
    	}
    	return r
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:18 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  6. src/runtime/slice.go

    //
    // Do not remove or change the type signature.
    // See go.dev/issue/67401.
    //
    //go:linkname reflect_growslice reflect.growslice
    func reflect_growslice(et *_type, old slice, num int) slice {
    	// Semantically equivalent to slices.Grow, except that the caller
    	// is responsible for ensuring that old.len+num > old.cap.
    	num -= old.cap - old.len // preserve memory of old[old.len:old.cap]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  7. test/typeparam/slices.go

    }
    
    // _Min returns the minimum element in a slice of some ordered type.
    // If the slice is empty it returns the zero value of the element type.
    func _SliceMin[Elem Ordered](s []Elem) Elem {
    	if len(s) == 0 {
    		var zero Elem
    		return zero
    	}
    	return _Reduce(s[1:], s[0], _Min[Elem])
    }
    
    // _Append adds values to the end of a slice, returning a new slice.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 7.8K bytes
    - Viewed (0)
  8. src/internal/types/testdata/check/slices.go

    // Copyright 2019 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package slices implements various slice algorithms.
    package slices
    
    // Map turns a []T1 to a []T2 using a mapping function.
    func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {
    	r := make([]T2, len(s))
    	for i, v := range s {
    		r[i] = f(v)
    	}
    	return r
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:25 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  9. src/cmd/asm/internal/lex/slice.go

    	"cmd/internal/src"
    )
    
    // A Slice reads from a slice of Tokens.
    type Slice struct {
    	tokens []Token
    	base   *src.PosBase
    	line   int
    	pos    int
    }
    
    func NewSlice(base *src.PosBase, line int, tokens []Token) *Slice {
    	return &Slice{
    		tokens: tokens,
    		base:   base,
    		line:   line,
    		pos:    -1, // Next will advance to zero.
    	}
    }
    
    func (s *Slice) Next() ScanToken {
    	s.pos++
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 29 22:49:50 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  10. src/go/parser/testdata/slices.go2

    // Package slices implements various slice algorithms.
    package slices
    
    // Map turns a []T1 to a []T2 using a mapping function.
    func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {
    	r := make([]T2, len(s))
    	for i, v := range s {
    		r[i] = f(v)
    	}
    	return r
    }
    
    // Reduce reduces a []T1 to a single value using a reduction function.
    func Reduce[T1, T2 any](s []T1, initializer T2, f func(T2, T1) T2) T2 {
    	r := initializer
    	for _, v := range s {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 24 19:44:06 UTC 2020
    - 666 bytes
    - Viewed (0)
Back to top