28 : myData(capacity, capacity)
47 myFirstId = myLastId =
id;
52 growIfNeeded(
id - myLastId);
56 myData(myLast) = std::forward<S>(
data);
92 for (i = 0; i < number; i++)
102 return myData(idIndex(index));
105 template <
typename T>
109 fprintf(stderr,
"First = %d\n", myFirst);
110 fprintf(stderr,
"Last = %d\n", myLast);
111 fprintf(stderr,
"FirstId = %d\n", myFirstId);
112 fprintf(stderr,
"LastId = %d\n", myLastId);
113 fprintf(stderr,
"Capacity = %d\n", myData.entries());
114 fprintf(stderr,
"Peak = %d\n", myPeak);
117 template <
typename T>
121 if (entries() > myPeak)
123 if (entries() + number > myData.entries())
128 origcapacity = myData.entries();
129 capacity = UTbumpAlloc(origcapacity + number);
133 myData.setCapacity(capacity);
134 myData.entries(capacity);
138 if (myLast >= 0 && myLast < myFirst)
141 myFirst + capacity - origcapacity,
142 origcapacity - myFirst);
143 myFirst += capacity - origcapacity;
T operator[](int id) const
void pop()
Pop a single element from the start of the buffer.
void remove(int id)
Remove item with id.
void clear()
Resets the buffer to an empty buffer with a 0 index.
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int