asmjit::ZoneVector< T > Class Template Reference

template<typename T>
class asmjit::ZoneVector< T >

Template used to store and manage array of Zone allocated data.

This template has these advantages over other std::vector<>:

  • Always non-copyable (designed to be non-copyable, we want it).
  • Optimized for working only with POD types.
  • Uses ZoneAllocator, thus small vectors are almost for free.
  • Explicit allocation, ZoneAllocator is not part of the data.

Public Members

- Public Attributes inherited from asmjit::ZoneVectorBase

Public Types

- Public Types inherited from asmjit::ZoneVectorBase

Member Functions

Construction & Destruction
Accessors
STL Compatibility (Iterators)
Utilities
Memory Management
- Public Member Functions inherited from asmjit::ZoneVectorBase

Additional Inherited Members

- Protected Member Functions inherited from asmjit::ZoneVectorBase

Member Function Documentation

template<typename T>
T* ZoneVector<T>::data()noexcept[1/2]

Returns vector data.

template<typename T>
const T* ZoneVector<T>::data() constnoexcept[2/2]

Returns vector data (const)

template<typename T>
const T& ZoneVector<T>::at(size_t i) constnoexcept

Returns item at the given index i (const).

template<typename T>
void ZoneVector<T>::swap(ZoneVector<T>& other)noexcept

Swaps this vector with other.

template<typename T>
Error ZoneVector<T>::prepend(ZoneAllocator* allocator, const T& item)noexcept

Prepends item to the vector.

template<typename T>
Error ZoneVector<T>::insert(ZoneAllocator* allocator, size_t index, const T& item)noexcept

Inserts an item at the specified index.

template<typename T>
Error ZoneVector<T>::append(ZoneAllocator* allocator, const T& item)noexcept

Appends item to the vector.

template<typename T>
Error ZoneVector<T>::concat(ZoneAllocator* allocator, const ZoneVector<T>& other)noexcept

Appends other vector at the end of this vector.

template<typename T>
void ZoneVector<T>::prependUnsafe(const T& item)noexcept

Prepends item to the vector (unsafe case).

Can only be used together with willGrow(). If willGrow(N) returns kErrorOk then N elements can be added to the vector without checking if there is a place for them. Used mostly internally.

template<typename T>
void ZoneVector<T>::appendUnsafe(const T& item)noexcept

Append sitem to the vector (unsafe case).

Can only be used together with willGrow(). If willGrow(N) returns kErrorOk then N elements can be added to the vector without checking if there is a place for them. Used mostly internally.

template<typename T>
void ZoneVector<T>::insertUnsafe(size_t index, const T& item)noexcept

Inserts an item at the specified index (unsafe case).

template<typename T>
void ZoneVector<T>::concatUnsafe(const ZoneVector<T>& other)noexcept

Concatenates all items of other at the end of the vector.

template<typename T>
uint32_t ZoneVector<T>::indexOf(const T& val) constnoexcept

Returns index of the given val or Globals::kNotFound if it doesn't exist.

template<typename T>
bool ZoneVector<T>::contains(const T& val) constnoexcept

Tests whether the vector contains val.

template<typename T>
void ZoneVector<T>::removeAt(size_t i)noexcept

Removes item at index i.

template<typename T>
T ZoneVector<T>::pop()noexcept

Pops the last element from the vector and returns it.

template<typename T>
T& ZoneVector<T>::operator[](size_t i)noexcept[1/2]

Returns item at index i.

template<typename T>
const T& ZoneVector<T>::operator[](size_t i) constnoexcept[2/2]

Returns item at index i.

template<typename T>
T& ZoneVector<T>::first()noexcept[1/2]

Returns a reference to the first element of the vector.

Note
The vector must have at least one element. Attempting to use first() on empty vector will trigger an assertion failure in debug builds.

template<typename T>
const T& ZoneVector<T>::first() constnoexcept[2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename T>
T& ZoneVector<T>::last()noexcept[1/2]

Returns a reference to the last element of the vector.

Note
The vector must have at least one element. Attempting to use last() on empty vector will trigger an assertion failure in debug builds.

template<typename T>
const T& ZoneVector<T>::last() constnoexcept[2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename T>
void ZoneVector<T>::release(ZoneAllocator* allocator)noexcept

Releases the memory held by ZoneVector<T> back to the allocator.

template<typename T>
Error ZoneVector<T>::grow(ZoneAllocator* allocator, uint32_t n)noexcept

Called to grow the buffer to fit at least n elements more.

template<typename T>
Error ZoneVector<T>::resize(ZoneAllocator* allocator, uint32_t n)noexcept

Resizes the vector to hold n elements.

If n is greater than the current size then the additional elements' content will be initialized to zero. If n is less than the current size then the vector will be truncated to exactly n elements.

template<typename T>
Error ZoneVector<T>::reserve(ZoneAllocator* allocator, uint32_t n)noexcept

Reallocates the internal array to fit at least n items.