CQueue::peek() Bug?

Applies to V1.0.10 and V1.1

I am using CQueue in an application and need to inspect the item at the head of the queue. I tried using CQueue::peek(), but this returns the item at the back of the queue.

[color="#00aa00"]CQueue line 112: [/color]

return $this->_d[$this->_c-1];

I have looked at CStack, and this works as I would expect, i.e. CStack::peek() returns the item at the top of the stack and leaves it there.

Similarly, should CQueue::peek() not return the item at the head of the queue - i.e. the same as you would get by calling CQueue::dequeue(), except leaving in the queue?

If I am right changing line 112 to

return $this->_d[0];

gives the expected result.

If I am not right a quick explanation would be appreciated.

Thanks in advance.

Thanks. Fixed.