1 #ifndef GIM_ARRAY_H_INCLUDED 2 #define GIM_ARRAY_H_INCLUDED 38 #define GIM_ARRAY_GROW_INCREMENT 2 39 #define GIM_ARRAY_GROW_FACTOR 2 58 if(m_data==NULL)
return;
73 m_data = (T*)
gim_realloc(m_data,m_size*
sizeof(T),newsize*
sizeof(T));
77 m_data = (T*)
gim_alloc(newsize*
sizeof(T));
79 m_allocated_size = newsize;
85 if(m_allocated_size<=m_size)
99 if(m_allocated_size>=size)
return false;
105 while(m_size>start_range)
127 m_allocated_size = 0;
135 m_allocated_size = 0;
200 return m_data[m_size-1];
205 return m_data[m_size-1];
252 swap(index,m_size-1);
275 for(
GUINT i = m_size;i>index;i--)
297 m_data[
m_size] = fillData;
324 #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.
const T * get_pointer_at(GUINT i) const
void insert(const T &obj, GUINT index)
void resize(GUINT size, bool call_constructor=true, const T &fillData=T())
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
Very simple array container with fast access and simd memory.
void swap(GUINT i, GUINT j)
void destroyData()
protected operations
void insert_mem(GUINT index)
const T & at(GUINT i) const
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 * pointer() 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)
const T & operator[](size_t i) const