New gives a new heap object.
()
| 13 | |
| 14 | // New gives a new heap object. |
| 15 | func New[T constraints.Ordered]() *Heap[T] { |
| 16 | less := func(a, b T) bool { |
| 17 | return a < b |
| 18 | } |
| 19 | h, _ := NewAny[T](less) |
| 20 | return h |
| 21 | } |
| 22 | |
| 23 | // NewAny gives a new heap object. element can be anything, but must provide less function. |
| 24 | func NewAny[T any](less func(a, b T) bool) (*Heap[T], error) { |
nothing calls this directly
no outgoing calls
no test coverage detected