Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 504 for nelem (0.04 sec)

  1. src/internal/types/testdata/check/issues1.go

    type Element2[TElem any] struct {
    	next, prev *Element2[TElem]
    	list *List2[TElem]
    	Value TElem
    }
    
    type List2[TElem any] struct {
    	root Element2[TElem]
    	len  int
    }
    
    func (l *List2[TElem]) Init() *List2[TElem] {
    	l.root.next = &l.root
    	l.root.prev = &l.root
    	l.len = 0
    	return l
    }
    
    // Self-recursive instantiations must work correctly.
    type A[P any] struct { _ *A[P] }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:56:37 UTC 2023
    - 6K bytes
    - Viewed (0)
  2. src/embed/embed.go

    	//	q/s/u
    	//	q/v
    	//	w
    	//
    	// is actually sorted as:
    	//
    	//	p       # dir=.    elem=p
    	//	q/      # dir=.    elem=q
    	//	w/      # dir=.    elem=w
    	//	q/r     # dir=q    elem=r
    	//	q/s/    # dir=q    elem=s
    	//	q/v     # dir=q    elem=v
    	//	q/s/t   # dir=q/s  elem=t
    	//	q/s/u   # dir=q/s  elem=u
    	//
    	// This order brings directory contents together in contiguous sections
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:42:51 UTC 2024
    - 13.5K bytes
    - Viewed (0)
  3. src/testing/fstest/mapfs.go

    		for fname, f := range fsys {
    			if strings.HasPrefix(fname, prefix) {
    				felem := fname[len(prefix):]
    				i := strings.Index(felem, "/")
    				if i < 0 {
    					list = append(list, mapFileInfo{felem, f})
    				} else {
    					need[fname[len(prefix):len(prefix)+i]] = true
    				}
    			}
    		}
    		// If the directory name is not in the map,
    		// and there are no children of the name in the map,
    		// then the directory is treated as not existing.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  4. src/runtime/mgcsweep.go

    		// more detail.
    		print("runtime: nelems=", s.nelems, " nalloc=", nalloc, " previous allocCount=", s.allocCount, " nfreed=", nfreed, "\n")
    		throw("sweep increased allocation count")
    	}
    
    	s.allocCount = nalloc
    	s.freeindex = 0 // reset allocation index to start of span.
    	s.freeIndexForScan = 0
    	if traceEnabled() {
    		getg().m.p.ptr().trace.reclaimed += uintptr(nfreed) * s.elemsize
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:52:18 UTC 2024
    - 32.9K bytes
    - Viewed (0)
  5. test/typeparam/setsimp.dir/a.go

    func Make[Elem comparable]() Set[Elem] {
    	return Set[Elem]{m: make(map[Elem]struct{})}
    }
    
    // Add adds an element to a set.
    func (s Set[Elem]) Add(v Elem) {
    	s.m[v] = struct{}{}
    }
    
    // Delete removes an element from a set. If the element is not present
    // in the set, this does nothing.
    func (s Set[Elem]) Delete(v Elem) {
    	delete(s.m, v)
    }
    
    // Contains reports whether v is in the set.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 26 21:39:54 UTC 2021
    - 2.7K bytes
    - Viewed (0)
  6. src/go/parser/testdata/set.go2

    package set
    
    type Set[Elem comparable] map[Elem]struct{}
    
    func Make[Elem comparable]() Set[Elem] {
    	return make(Set(Elem))
    }
    
    func (s Set[Elem]) Add(v Elem) {
    	s[v] = struct{}{}
    }
    
    func (s Set[Elem]) Delete(v Elem) {
    	delete(s, v)
    }
    
    func (s Set[Elem]) Contains(v Elem) bool {
    	_, ok := s[v]
    	return ok
    }
    
    func (s Set[Elem]) Len() int {
    	return len(s)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 24 19:44:06 UTC 2020
    - 474 bytes
    - Viewed (0)
  7. test/typeparam/chansimp.dir/a.go

    // until c is closed or the context is canceled, at which point the
    // returned channel is closed.
    func Filter[Elem any](ctx context.Context, c <-chan Elem, f func(Elem) bool) <-chan Elem {
    	r := make(chan Elem)
    	go func(ctx context.Context, c <-chan Elem, f func(Elem) bool, r chan<- Elem) {
    		defer close(r)
    		for {
    			select {
    			case <-ctx.Done():
    				return
    			case v, ok := <-c:
    				if !ok {
    					return
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jul 28 21:40:40 UTC 2021
    - 5.5K bytes
    - Viewed (0)
  8. test/typeparam/ordered.go

    		~float32 | ~float64 |
    		~string
    }
    
    type orderedSlice[Elem Ordered] []Elem
    
    func (s orderedSlice[Elem]) Len() int { return len(s) }
    func (s orderedSlice[Elem]) Less(i, j int) bool {
    	if s[i] < s[j] {
    		return true
    	}
    	isNaN := func(f Elem) bool { return f != f }
    	if isNaN(s[i]) && !isNaN(s[j]) {
    		return true
    	}
    	return false
    }
    func (s orderedSlice[Elem]) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  9. test/typeparam/chans.go

    // until c is closed or the context is canceled, at which point the
    // returned channel is closed.
    func _Filter[Elem any](ctx context.Context, c <-chan Elem, f func(Elem) bool) <-chan Elem {
    	r := make(chan Elem)
    	go func(ctx context.Context, c <-chan Elem, f func(Elem) bool, r chan<- Elem) {
    		defer close(r)
    		for {
    			select {
    			case <-ctx.Done():
    				return
    			case v, ok := <-c:
    				if !ok {
    					return
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 8.4K bytes
    - Viewed (0)
  10. src/go/parser/testdata/sort.go2

    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})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 24 19:44:06 UTC 2020
    - 902 bytes
    - Viewed (0)
Back to top