diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-04-11 22:47:43 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-04-11 22:47:43 -0700 |
| commit | 0ae786244aeea5c66b2305459b1fd14d11c24e88 (patch) | |
| tree | e51b3fe3248e4ef1daa00e8dec86aab0c2d69558 /deque.go | |
| parent | Add a .String() method (diff) | |
| download | deque-0ae786244aeea5c66b2305459b1fd14d11c24e88.tar.zst | |
Update documentation
Diffstat (limited to 'deque.go')
| -rw-r--r-- | deque.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -3,9 +3,9 @@ // // This queue has O(1) amortized inserts and removals from both ends of the // container. It also has O(1) indexing like a vector. -package deque - +// // The core implementation is "ported" (stolen) from Rust's VecDeque. +package deque import ( "fmt" @@ -42,7 +42,7 @@ func (q *Deque[T]) toPhysicalIdx(i int) int { return q.wrapAdd(q.head, i) } -// At returns the item at position i. +// At returns the item at position i. At panics if i < 0 or i >= q.Len(). func (q *Deque[T]) At(i int) T { if !(0 <= i && i < len(q.buf)) { panic(fmt.Sprintf("index out of range [%d] with length %d", i, len(q.buf))) |
