23 #include <shogun/lib/config.h> 41 template<
class T>
class v_array
120 void push(
const T &new_elem);
128 void push_many(
const T* new_elem,
size_t num);
173 size_t new_length = 2 * old_length + 3;
175 begin = SG_REALLOC(T, begin, old_length, new_length);
176 end = begin + old_length;
190 begin = SG_REALLOC(T, begin, length, new_length);
194 sg_memcpy(
end, new_elem, num *
sizeof(T));
202 begin = SG_REALLOC(T, begin, old_length, length);
203 if (old_length < length)
204 memset(begin + old_length, 0, (length - old_length)*
sizeof(T));
213 begin = SG_CALLOC(T, length);
221 if (stack.end != stack.begin)
222 return *(--stack.end);
void reserve(size_t length)
T * end
Pointer to last set element in the array.
T * begin
Pointer to first element of the array.
void push_many(const T *new_elem, size_t num)
Class v_array taken directly from JL's implementation.
void push(const T &new_elem)
T * end_array
Pointer to end of array, based on memory reserved.
T & operator[](unsigned int i)
all of classes and functions are contained in the shogun namespace
void calloc_reserve(size_t length)