Explorar o código

AK: Add CircularQueue::at().

Andreas Kling %!s(int64=6) %!d(string=hai) anos
pai
achega
f87dec1cbf
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      AK/CircularQueue.h

+ 2 - 0
AK/CircularQueue.h

@@ -46,6 +46,8 @@ public:
         return value;
     }
 
+    const T& at(int index) const { return m_elements[(m_head + index) % Capacity]; }
+
     class ConstIterator {
     public:
         bool operator!=(const ConstIterator& other) { return m_index != other.m_index; }