Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 642 for Map (0.06 sec)

  1. src/reflect/benchmark_test.go

    }
    
    func BenchmarkMap(b *testing.B) {
    	type V *int
    	type S string
    	value := ValueOf((V)(nil))
    	stringKeys := []string{}
    	mapOfStrings := map[string]V{}
    	uint64Keys := []uint64{}
    	mapOfUint64s := map[uint64]V{}
    	userStringKeys := []S{}
    	mapOfUserStrings := map[S]V{}
    	for i := 0; i < 100; i++ {
    		stringKey := fmt.Sprintf("key%d", i)
    		stringKeys = append(stringKeys, stringKey)
    		mapOfStrings[stringKey] = nil
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Nov 19 17:09:03 UTC 2023
    - 8.8K bytes
    - Viewed (0)
  2. src/reflect/deepequal.go

    // Visited comparisons are stored in a map indexed by visit.
    type visit struct {
    	a1  unsafe.Pointer
    	a2  unsafe.Pointer
    	typ Type
    }
    
    // Tests for deep equality using reflected types. The map argument tracks
    // comparisons that have already been seen, which allows short circuiting on
    // recursive types.
    func deepValueEqual(v1, v2 Value, visited map[visit]bool) bool {
    	if !v1.IsValid() || !v2.IsValid() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:30 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  3. test/typeparam/issue48453.go

    // license that can be found in the LICENSE file.
    
    package main
    
    //go:noinline
    func CopyMap[M interface{ ~map[K]V }, K comparable, V any](m M) M {
    	out := make(M, len(m))
    	for k, v := range m {
    		out[k] = v
    	}
    	return out
    }
    
    func main() {
    	var m map[*string]int
    	CopyMap(m)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 393 bytes
    - Viewed (0)
  4. src/internal/concurrent/hashtriemap_test.go

    	})
    }
    
    func testAll[K, V comparable](t *testing.T, m *HashTrieMap[K, V], testData map[K]V, yield func(K, V) bool) {
    	for k, v := range testData {
    		expectStored(t, k, v)(m.LoadOrStore(k, v))
    	}
    	visited := make(map[K]int)
    	m.All()(func(key K, got V) bool {
    		want, ok := testData[key]
    		if !ok {
    			t.Errorf("unexpected key %v in map", key)
    			return false
    		}
    		if got != want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 16:01:55 UTC 2024
    - 9.3K bytes
    - Viewed (0)
  5. test/fixedbugs/issue54722b.go

    package p
    
    type value[V comparable] struct {
    	node  *node[value[V]]
    	value V
    }
    
    type node[V comparable] struct {
    	index    *index[V]
    	children map[string]*node[V]
    }
    
    type index[V comparable] struct {
    	arrays []array[V]
    }
    
    type array[V comparable] struct {
    	valueMap map[int]V
    }
    
    var x value[int]
    var y value[*Column]
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 30 17:23:27 UTC 2022
    - 523 bytes
    - Viewed (0)
  6. src/testing/slogtest/example_test.go

    // format when given a pointer to a map[string]any.
    func Example_parsing() {
    	var buf bytes.Buffer
    	h := slog.NewJSONHandler(&buf, nil)
    
    	results := func() []map[string]any {
    		var ms []map[string]any
    		for _, line := range bytes.Split(buf.Bytes(), []byte{'\n'}) {
    			if len(line) == 0 {
    				continue
    			}
    			var m map[string]any
    			if err := json.Unmarshal(line, &m); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  7. src/text/template/option.go

    //
    // missingkey: Control the behavior during execution if a map is
    // indexed with a key that is not present in the map.
    //
    //	"missingkey=default" or "missingkey=invalid"
    //		The default behavior: Do nothing and continue execution.
    //		If printed, the result of the index operation is the string
    //		"<no value>".
    //	"missingkey=zero"
    //		The operation returns the zero value for the map type's element.
    //	"missingkey=error"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 1.9K bytes
    - Viewed (0)
  8. test/typeparam/index2.go

    	x[2] = 'b'
    	return x[3]
    }
    
    // Can index an argument (read/write) constrained to be a map. Maps can't
    // be combined with any other type for indexing purposes.
    func Index3[T interface{ map[int]int64 }](x T) int64 {
    	x[2] = 43
    	return x[3]
    }
    
    // But the type of the map keys or values can be parameterized.
    func Index4[T any](x map[int]T) T {
    	var zero T
    	x[2] = zero
    	return x[3]
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  9. test/fixedbugs/notinheap.go

    // Test type-checking errors for go:notinheap.
    
    package p
    
    //go:notinheap
    type nih struct{}
    
    type embed4 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
    
    type embed5 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
    
    type emebd6 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
    
    type okay1 *nih
    
    type okay2 []nih
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 17:46:15 UTC 2022
    - 1.3K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/ssa/shift_test.go

    	checkOpcodeCounts(t, fun.f, map[Op]int{OpAMD64SHLQconst: 1, OpAMD64CMPQconst: 0, OpAMD64ANDQconst: 0})
    
    	fun = makeConstShiftFunc(c, 66, OpLsh64x64, c.config.Types.UInt64)
    	checkOpcodeCounts(t, fun.f, map[Op]int{OpAMD64SHLQconst: 0, OpAMD64CMPQconst: 0, OpAMD64ANDQconst: 0})
    
    	fun = makeConstShiftFunc(c, 18, OpRsh64Ux64, c.config.Types.UInt64)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 4K bytes
    - Viewed (0)
Back to top