- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 675 for Map (0.04 sec)
-
test/typeparam/issue48716.dir/a.go
return Pair[L, R]{L: l, R: r} } type Map[K, V any] interface { Put(K, V) Len() int Iterate(func(Pair[K, V]) bool) } type HashMap[K comparable, V any] struct { m map[K]V } func NewHashMap[K comparable, V any](capacity int) HashMap[K, V] { var m map[K]V if capacity >= 1 { m = make(map[K]V, capacity) } else { m = map[K]V{} } return HashMap[K, V]{m: m} }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 12 20:09:58 UTC 2021 - 861 bytes - Viewed (0) -
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) -
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) -
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) -
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) -
src/internal/types/testdata/fixedbugs/issue50755.go
// during constraint type inference. func f4[M4 map[K4]int, K4 comparable](m4 M4) {} func f5[M5 map[K5]int, K5 comparable](m5 M5) { f4(m5) } // test case from issue func Copy[MC ~map[KC]VC, KC comparable, VC any](dst, src MC) { for k, v := range src { dst[k] = v } } func Merge[MM ~map[KM]VM, KM comparable, VM any](ms ...MM) MM { result := MM{} for _, m := range ms { Copy(result, m) } return result
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 02 02:58:32 UTC 2022 - 1K bytes - Viewed (0) -
src/sync/map_reference_test.go
} func (m *DeepCopyMap) Range(f func(key, value any) (shouldContinue bool)) { clean, _ := m.clean.Load().(map[any]any) for k, v := range clean { if !f(k, v) { break } } } func (m *DeepCopyMap) dirty() map[any]any { clean, _ := m.clean.Load().(map[any]any) dirty := make(map[any]any, len(clean)+1) for k, v := range clean { dirty[k] = v } return dirty }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Feb 01 15:34:22 UTC 2024 - 5.6K bytes - Viewed (0) -
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) -
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) -
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)