-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inline bounds checks are not always necessary and I'd rather not force a clunkier interface on users. Just write your own functions: func Pop(q *FlatQueue) (int, bool) { if q.Len() == 0 { return 0, false } return q.Pop(), true } func Peek(q *FlatQueue) (int, bool) { if q.Len() == 0 { return 0, false } return q.Peek(), true } func PeekValue(q *FlatQueue) (float64, bool) { if q.Len() == 0 { return 0, false } return q.PeekValue(), true }
- Loading branch information
1 parent
a567c8b
commit 0262637
Showing
3 changed files
with
57 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters