22 #ifndef SCI_GRAPHICS_LISTS32_H 23 #define SCI_GRAPHICS_LISTS32_H 25 #include "common/array.h" 42 template<
class T, u
int N>
49 typedef T *
const *const_iterator;
50 typedef T *value_type;
51 typedef uint size_type;
55 for (size_type i = 0; i < _size; ++i) {
56 if (other._items[i] ==
nullptr) {
59 _items[i] =
new T(*other._items[i]);
65 for (size_type i = 0; i < _size; ++i) {
66 _items[i] = other._items[i];
67 other._items[i] =
nullptr;
71 for (size_type i = 0; i < _size; ++i) {
79 for (size_type i = 0; i < _size; ++i) {
80 if (other._items[i] ==
nullptr) {
83 _items[i] =
new T(*other._items[i]);
92 for (size_type i = 0; i < _size; ++i) {
93 _items[i] = other._items[i];
94 other._items[i] =
nullptr;
98 T *
const &operator[](size_type index)
const {
99 assert(index < _size);
100 return _items[index];
103 T *&operator[](size_type index) {
104 assert(index < _size);
105 return _items[index];
113 _items[_size++] = item;
120 const_iterator begin()
const {
125 for (size_type i = 0; i < _size; ++i) {
134 return _items + _size;
137 const_iterator end()
const {
138 return _items + _size;
145 for (iterator it = begin(); it != end(); ++it) {
158 assert(it >= _items && it < _items + _size);
167 assert(index < _size);
169 delete _items[index];
170 _items[index] =
nullptr;
177 iterator freePtr = begin();
178 size_type newSize = 0;
180 for (iterator it = begin(), last = end(); it != last; ++it) {
181 if (*it !=
nullptr) {
214 template<
class T, u
int N>
219 typedef T **iterator;
220 typedef T *
const *const_iterator;
221 typedef T *value_type;
222 typedef uint size_type;
229 for (size_type i = 0; i < other.
size(); ++i) {
230 if (other._items[i] ==
nullptr) {
233 _items.
push_back(
new T(*other._items[i]));
241 for (size_type i = 0; i < _items.
size(); ++i) {
248 for (size_type i = 0; i < other.
size(); ++i) {
249 if (other._items[i] ==
nullptr) {
252 _items.
push_back(
new T(*other._items[i]));
261 T *
const &operator[](size_type index)
const {
262 return _items[index];
265 T *&operator[](size_type index) {
266 return _items[index];
277 return _items.
begin();
280 const_iterator begin()
const {
281 return _items.
begin();
285 for (size_type i = 0; i < _items.
size(); ++i) {
295 const_iterator end()
const {
303 for (iterator it = begin(); it != end(); ++it) {
316 assert(it >= begin() && it < end());
325 delete _items[index];
326 _items[index] =
nullptr;
333 iterator freePtr = begin();
334 size_type newSize = 0;
336 for (iterator it = begin(), last = end(); it != last; ++it) {
337 if (*it !=
nullptr) {
352 return _items.
size();
358 const reg_t &_object;
361 bool operator()(
const T entry)
const {
362 return entry && entry->_object == _object;
368 #endif // SCI_GRAPHICS_LISTS32_H size_type pack()
Definition: lists32.h:176
void add(T *item)
Definition: lists32.h:272
iterator end()
Definition: array.h:379
iterator begin()
Definition: array.h:374
size_type size() const
Definition: lists32.h:351
void add(T *item)
Definition: lists32.h:111
size_type pack()
Definition: lists32.h:332
void push_back(const T &element)
Definition: array.h:180
void erase(T *item)
Definition: lists32.h:302
void reserve(size_type newCapacity)
Definition: array.h:396
void erase(iterator &it)
Definition: lists32.h:157
void erase_at(size_type index)
Definition: lists32.h:166
Definition: lists32.h:215
size_type size() const
Definition: array.h:315
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
size_type max_size() const
Definition: lists32.h:195
void resize(size_type newSize)
Definition: array.h:411
Definition: lists32.h:357
void erase_at(size_type index)
Definition: lists32.h:324
void erase(iterator &it)
Definition: lists32.h:315
T MAX(T a, T b)
Definition: util.h:62
Definition: vm_types.h:39
void erase(T *item)
Definition: lists32.h:144
size_type size() const
Definition: lists32.h:203