test/fixedbugs/issue57778.go
raw| 1 | // compile |
| 2 | |
| 3 | // Copyright 2023 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | package p |
| 8 | |
| 9 | type FreeListG[T any] struct { |
| 10 | freelist []*node[T] |
| 11 | } |
| 12 | |
| 13 | type node[T any] struct{} |
| 14 | |
| 15 | func NewFreeListG[T any](size int) *FreeListG[T] { |
| 16 | return &FreeListG[T]{freelist: make([]*node[T], 0, size)} |
| 17 | } |
| 18 | |
| 19 | var bf = NewFreeListG[*int](1024) |