1 #ifndef GIM_ARRAY_H_INCLUDED 2 #define GIM_ARRAY_H_INCLUDED 37 #define GIM_ARRAY_GROW_INCREMENT 2 38 #define GIM_ARRAY_GROW_FACTOR 2 57 if (m_data == NULL)
return;
72 m_data = (T*)
gim_realloc(m_data, m_size *
sizeof(T), newsize *
sizeof(T));
76 m_data = (T*)
gim_alloc(newsize *
sizeof(T));
78 m_allocated_size = newsize;
84 if (m_allocated_size <= m_size)
98 if (m_allocated_size >= size)
return false;
104 while (m_size > start_range)
112 if (m_size == 0)
return;
126 m_allocated_size = 0;
134 m_allocated_size = 0;
200 return m_data[m_size - 1];
205 return m_data[m_size - 1];
249 if (index < m_size - 1)
251 swap(index, m_size - 1);
274 for (
GUINT i = m_size; i > index; i--)
292 if (call_constructor)
294 while (m_size < size)
296 m_data[
m_size] = fillData;
305 else if (size < m_size)
318 #endif // GIM_CONTAINERS_H_INCLUDED void erase(GUINT index)
fast erase
void gim_simd_memcpy(void *dst, const void *src, size_t copysize)
void push_back_memcpy(const T &obj)
void push_back_mem()
Simply increase the m_size, doesn't call the new element constructor.
void insert(const T &obj, GUINT index)
void resize(GUINT size, bool call_constructor=true, const T &fillData=T())
const T & at(GUINT i) const
void clear_range(GUINT start_range)
void erase_sorted(GUINT index)
#define GIM_ARRAY_GROW_FACTOR
bool resizeData(GUINT newsize)
#define GIM_ARRAY_GROW_INCREMENT
const T * pointer() const
Very simple array container with fast access and simd memory.
void swap(GUINT i, GUINT j)
void destroyData()
protected operations
const T * get_pointer_at(GUINT i) const
void insert_mem(GUINT index)
void * gim_realloc(void *ptr, size_t oldsize, size_t newsize)
void erase_sorted_mem(GUINT index)
gim_array(GUINT reservesize)
void gim_swap_elements(T *_array, size_t _i, size_t _j)
const T & operator[](size_t i) const
T * get_pointer_at(GUINT i)
void * gim_alloc(size_t size)
Standar Memory functions.
void pop_back_mem()
Simply decrease the m_size, doesn't call the deleted element destructor.
bool reserve(GUINT size)
public operations
void push_back(const T &obj)