26template <
class T, 
int fixedBufferSize = 32>
 
   39  inline unsigned int num()
 const {
return _length;}
 
   41  inline T* 
at(
unsigned int pos)
 const { 
return (pos<_length) ? _block[pos] : 
nullptr; }
 
   47  inline T* 
last() {
return at(_length-1);}
 
   53  virtual void swap(
unsigned int p1,
unsigned int p2);
 
   80  unsigned int _capacity;
 
   97template <
class T, 
int fixedBufferSize>
 
  102  _block     = _fixedBuffer;
 
  104  if (init > _capacity) {
 
  106    _block = 
new T*[_capacity];
 
 
  110template <
class T, 
int fixedBufferSize>
 
  113  *
this = std::move(
other);
 
 
  116template <
class T, 
int fixedBufferSize>
 
  119  _length = 
other._length;
 
  121  _capacity = 
other._capacity;
 
  126    _block = _fixedBuffer;
 
  127    for (
auto i = 0u; 
i < _length; ++
i)
 
  129      _fixedBuffer[
i] = 
other._fixedBuffer[
i];
 
  134    _block = 
other._block;
 
 
  143template <
class T, 
int fixedBufferSize>
 
  151template <
class T, 
int fixedBufferSize>
 
  154  if (_block != _fixedBuffer)
 
  162  _block = _fixedBuffer;
 
 
  167template <
class T, 
int fixedBufferSize>
 
  170  for (
unsigned int i = 0; 
i < _length; 
i++)
 
  172    delete _block[
i]; _block[
i] = 
nullptr;
 
 
  179template <
class T, 
int fixedBufferSize>
 
  182  reserve(_capacity * 2);
 
 
  187template <
class T, 
int fixedBufferSize>
 
  192    if (_length == _capacity)
 
  196    _block[_length] = 
elem;
 
 
  204template <
class T, 
int fixedBufferSize>
 
  207  if (_length == _capacity)
 
  211  _block[_length] = 
elem;
 
 
 
  218template <
class T, 
int fixedBufferSize>
 
  226template <
class T, 
int fixedBufferSize>
 
  242template <
class T, 
int fixedBufferSize>
 
  245  if (pos != _length-1)
 
 
  254template <
class T, 
int fixedBufferSize>
 
  265template <
class T, 
int fixedBufferSize>
 
  269  for (
unsigned int i = 0; 
i < _length; 
i++)
 
  271    if (_block[
i] == 
elem)
 
 
  282template <
class T, 
int fixedBufferSize>
 
  285  const int pos = lookup(
elem);
 
 
  295template <
class T, 
int fixedBufferSize>
 
  298  const int pos = lookup(
elem);
 
  301    for (
unsigned int i = pos; 
i < _length-1; 
i++)
 
  303      _block[
i] = _block[
i+1];
 
 
  312template <
class T, 
int fixedBufferSize>
 
  315  if (init <= _capacity) { 
return; }
 
  319  for (
unsigned int i = 0; 
i < _length; 
i++)
 
  323  if (_block != _fixedBuffer)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dynamic templated vector.
 
virtual void clear()
Clears all internal pointers.
 
T * last()
Returns the last element.
 
WEMVector(unsigned int init=0)
Standard constructor.
 
WEMVector(WEMVector &&other) noexcept
 
virtual void replace(T *elem, unsigned int pos)
Replaces the given position with the given element.
 
const T * first() const
Returns the first element.
 
WEMVector & operator=(WEMVector &&other) noexcept
 
virtual void destroy()
Deletes all elements in this vector.
 
virtual unsigned int append(T *elem)
Appends the given element to back of this vector.
 
virtual void expand()
Grow vector, add extra block of size BLOCKSIZE.
 
T * at(unsigned int pos) const
Returns the element at the given position or returns NULL if out of range.
 
unsigned int num() const
Returns the number of elements in this vector.
 
virtual int removeUnSwapped(T *elem)
Deletes the element given by its pointer. Keeps the order of the elements!
 
virtual int lookup(T *elem) const
Searches for the given element in this vector and returns its position.
 
virtual void swap(unsigned int p1, unsigned int p2)
Swaps the two elements given by their indices in this vector.
 
virtual void deleteAt(unsigned int pos)
Deletes the element at the given position.
 
const T * last() const
Returns the last element.
 
virtual int remove(T *elem)
Deletes the element given by its pointer.
 
virtual unsigned int appendUnsafe(T *elem)
Append element to back of vector, don't check on element being non-NULL.
 
virtual void deleteLast()
Deletes the last element of this vector.
 
virtual ~WEMVector()
Standard destructor.
 
T * first()
Returns the first element.
 
void reserve(unsigned int init)
Reserves init elements, copies old ones if existing.
 
Target mlrange_cast(Source arg)
Generic version of checked ML casts.