12 #ifndef SMALLVEC_TYPE_HPP
13 #define SMALLVEC_TYPE_HPP
28 template <
typename T, u
int S>
89 if ((
const void *)&other == (
void *)
this)
return;
123 if (capacity >= this->capacity)
return;
136 uint begin = this->
items;
137 this->
items += to_add;
144 return &this->
data[begin];
153 this->
items = num_items;
167 inline const T *
Find(
const T &item)
const
169 const T *pos = this->
Begin();
170 const T *end = this->
End();
171 while (pos != end && *pos != item) pos++;
183 T *pos = this->
Begin();
184 const T *end = this->
End();
185 while (pos != end && *pos != item) pos++;
198 const T *pos = this->
Begin();
199 const T *end = this->
End();
200 while (pos != end && *pos != item) {
204 return pos == end ? -1 : index;
215 return this->
Find(item) != this->
End();
225 assert(item >= this->
Begin() && item < this->
End());
236 if (count == 0)
return;
237 assert(pos < this->
items);
238 assert(pos + count <= this->items);
239 this->items -= count;
240 uint to_move = this->items - pos;
241 if (to_move > 0)
MemMoveT(this->
data + pos, this->
data + pos + count, to_move);
252 bool is_member = this->
Contains(item);
253 if (!is_member) *this->
Append() = item;
292 inline const T *
End()
const
313 inline const T *
Get(uint index)
const
316 assert(index <= this->
items);
317 return &this->
data[index];
329 assert(index <= this->
items);
330 return &this->
data[index];
341 assert(index < this->
items);
342 return this->
data[index];
353 assert(index < this->
items);
354 return this->
data[index];
369 template <
typename T, u
int S>
382 for (uint i = 0; i < this->
items; i++) {
400 template <
typename T, u
int S>
413 for (uint i = 0; i < this->
items; i++) {
414 delete this->
data[i];