Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 343 for Map (0.04 sec)

  1. src/unique/handle.go

    			toInsertWeak = weak.Make(toInsert)
    		}
    		return toInsertWeak
    	}
    	var ptr *T
    	for {
    		// Check the map.
    		wp, ok := m.Load(value)
    		if !ok {
    			// Try to insert a new value into the map.
    			wp, _ = m.LoadOrStore(value, newValue())
    		}
    		// Now that we're sure there's a value in the map, let's
    		// try to get the pointer we need out of it.
    		ptr = wp.Strong()
    		if ptr != nil {
    			break
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 16:01:55 UTC 2024
    - 5.3K bytes
    - Viewed (0)
  2. src/maps/maps.go

    // Values are compared using ==.
    func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool {
    	if len(m1) != len(m2) {
    		return false
    	}
    	for k, v1 := range m1 {
    		if v2, ok := m2[k]; !ok || v1 != v2 {
    			return false
    		}
    	}
    	return true
    }
    
    // EqualFunc is like Equal, but compares values using eq.
    // Keys are still compared with ==.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 28 20:35:05 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/test/mergelocals_test.go

    	testcases := []struct {
    		vars      []*ir.Name
    		partition map[*ir.Name][]int
    		experr    bool
    	}{
    		{
    			vars: []*ir.Name{v1, v2, v3},
    			partition: map[*ir.Name][]int{
    				v1: []int{0, 1, 2},
    				v2: []int{0, 1, 2},
    				v3: []int{0, 1, 2},
    			},
    			experr: false,
    		},
    		{
    			// invalid mls.v slot -1
    			vars: []*ir.Name{v1, v2, v3},
    			partition: map[*ir.Name][]int{
    				v1: []int{-1, 0},
    				v2: []int{0, 1, 2},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 15:43:53 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  4. src/text/template/template.go

    	return t
    }
    
    // Funcs adds the elements of the argument map to the template's function map.
    // It must be called before the template is parsed.
    // It panics if a value in the map is not a function with appropriate return
    // type or if the name cannot be used syntactically as a function in a template.
    // It is legal to overwrite elements of the map. The return value is the template,
    // so calls can be chained.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:57:51 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/types/pkg.go

    		// instantiations.
    		p.Prefix = path
    	} else {
    		p.Prefix = objabi.PathToPrefix(path)
    	}
    	p.Syms = make(map[string]*Sym)
    	pkgMap[path] = p
    
    	return p
    }
    
    func PkgMap() map[string]*Pkg {
    	return pkgMap
    }
    
    var nopkg = &Pkg{
    	Syms: make(map[string]*Sym),
    }
    
    func (pkg *Pkg) Lookup(name string) *Sym {
    	s, _ := pkg.LookupOK(name)
    	return s
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 08 16:28:50 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  6. src/maps/maps_test.go

    	}
    	if EqualFunc(m1, (map[int]int)(nil), equal[int]) {
    		t.Errorf("EqualFunc(%v, nil, equal) = true, want false", m1)
    	}
    	if EqualFunc((map[int]int)(nil), m1, equal[int]) {
    		t.Errorf("EqualFunc(nil, %v, equal) = true, want false", m1)
    	}
    	if !EqualFunc[map[int]int, map[int]int](nil, nil, equal[int]) {
    		t.Error("EqualFunc(nil, nil, equal) = false, want true")
    	}
    	if ms := map[int]int{1: 2}; EqualFunc(m1, ms, equal[int]) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 05 17:05:56 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  7. test/fixedbugs/issue62203.go

    	// Remove that 49th entry. m is still growing to 8 buckets,
    	// but a clone of m will only have 4 buckets because it
    	// only needs to fit 48 entries.
    	delete(m, "foo")
    
    	// Clone an 8-bucket map to a 4-bucket map.
    	_ = maps.Clone(m)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 25 16:10:03 UTC 2023
    - 688 bytes
    - Viewed (0)
  8. src/encoding/gob/type_test.go

    	}
    }
    
    func TestMapType(t *testing.T) {
    	var m map[string]int
    	mapStringInt := getTypeUnlocked("map", reflect.TypeOf(m))
    	var newm map[string]int
    	newMapStringInt := getTypeUnlocked("map1", reflect.TypeOf(newm))
    	if mapStringInt != newMapStringInt {
    		t.Errorf("second registration of map[string]int creates new type")
    	}
    	var b map[string]bool
    	mapStringBool := getTypeUnlocked("", reflect.TypeOf(b))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 01 14:26:13 UTC 2023
    - 6.1K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/syntax/testdata/map2.go

    // license that can be found in the LICENSE file.
    
    // This file is like map.go, but instead of importing chans, it contains
    // the necessary functionality at the end of the file.
    
    // Package orderedmap provides an ordered map, implemented as a binary tree.
    package orderedmap
    
    // Map is an ordered map.
    type Map[K, V any] struct {
    	root    *node[K, V]
    	compare func(K, K) int
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 01 12:49:49 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  10. src/mime/type.go

    	"sync"
    )
    
    var (
    	mimeTypes      sync.Map // map[string]string; ".Z" => "application/x-compress"
    	mimeTypesLower sync.Map // map[string]string; ".z" => "application/x-compress"
    
    	// extensions maps from MIME type to list of lowercase file
    	// extensions: "image/jpeg" => [".jpg", ".jpeg"]
    	extensionsMu sync.Mutex // Guards stores (but not loads) on extensions.
    	extensions   sync.Map   // map[string][]string; slice values are append-only.
    )
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5K bytes
    - Viewed (0)
Back to top