Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-kim committed Oct 4, 2023
1 parent 7eb8897 commit b9011b9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions utils/heap/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ import (

var _ stdheap.Interface = (*queue[int])(nil)

// NewQueue returns an empty min-heap ordered by less. See OfQueue for more.
// NewQueue returns an empty min-heap ordered by less. See QueueOf for more.
func NewQueue[T any](less func(a, b T) bool) Queue[T] {
return Queue[T]{
return QueueOf(less)
}

func QueueOf[T any](less func(a, b T) bool, entries ...T) Queue[T] {
q := Queue[T]{
queue: &queue[T]{
entries: make([]T, 0),
less: less,
},
}

for _, e := range entries {
q.Push(e)
}
}

Check failure on line 29 in utils/heap/queue.go

View workflow job for this annotation

GitHub Actions / test_upgrade

missing return

Check failure on line 29 in utils/heap/queue.go

View workflow job for this annotation

GitHub Actions / test_e2e

missing return

Check failure on line 29 in utils/heap/queue.go

View workflow job for this annotation

GitHub Actions / test_e2e_persistent

missing return

Check failure on line 29 in utils/heap/queue.go

View workflow job for this annotation

GitHub Actions / build_unit_test (self-hosted, linux, ARM64, focal)

missing return

Check failure on line 29 in utils/heap/queue.go

View workflow job for this annotation

GitHub Actions / build_unit_test (self-hosted, linux, ARM64, jammy)

missing return

type Queue[T any] struct {
Expand Down

0 comments on commit b9011b9

Please sign in to comment.