76 static_assert(std::is_trivially_copyable<T>::value,
77 "Only trivially copyable types are allowed with DataArray, since it does memcopy");
166 memmove(&(
data[i + n]), &(
data[i]), (
unsigned int)(j - i) *
sizeof(T));
176 for(
int j = 0; j < n; j++)
187 memcpy(&(
data[i]), t, (
unsigned int) n *
sizeof(T));
197 memcpy(&(
data[i]), t.
data, (
unsigned int)t.
size() *
sizeof(T));
204 assert(n <
size() && n >= 0);
208 memmove(&(
data[n]), &(
data[n + m]), (
unsigned int)(
size() - (n + m)) *
sizeof(T));
217 assert(m <=
size() && m >= 0);
271 void reMax(
int newMax = 1,
int newSize = -1)
302 memcpy(
data, rhs.
data, (
unsigned int)
size() *
sizeof(T));
313#ifdef ENABLE_CONSISTENCY_CHECKS
357 thesize = (p_size < 0) ? 0 : p_size;
Safe arrays of data objects.
void append(const DataArray< T > &t)
append all elements from t.
bool isConsistent() const
consistency check
T & operator[](int n)
reference n 'th element.
T * get_ptr()
get a C pointer to the data.
void append(int n, const T t[])
append n elements from t.
int themax
the length of array data and
DataArray & operator=(const DataArray &rhs)
assignment operator
DataArray(const DataArray &old)
copy constructor
const T & last() const
reference last const element.
int max() const
return maximum number of elements.
const T * get_const_ptr() const
get a const C pointer to the data.
void insert(int i, int n, const T &t)
insert n elements with value t before i 'the element.
void reMax(int newMax=1, int newSize=-1)
reset maximum number of elements.
void insert(int i, int n)
insert n uninitialized elements before i 'th element.
int thesize
number of used elements in array data
void reSize(int newsize)
reset size to newsize.
void removeLast(int m=1)
remove m last elements.
void append(const T &t)
append element t.
T * data
the array of elements
void clear()
remove all elements.
DataArray(int p_size=0, int p_max=0, Real p_fac=1.2)
default constructor.
const T & operator[](int n) const
reference n 'th const element.
void insert(int i, int n, const T t[])
insert n elements from t before i 'the element.
void remove(int n=0, int m=1)
remove m elements starting at n.
T & last()
reference last element.
Real memFactor
memory extension factor.
void append(int n, const T &t)
append n elements with value t.
void insert(int i, const DataArray< T > &t)
insert all elements from t before i 'th element.
int size() const
return nr. of elements.
Everything should be within this namespace.
void spx_free(T &p)
Release memory.
void spx_alloc(T &p, int n=1)
Allocate memory.
void spx_realloc(T &p, int n)
Change amount of allocated memory.
Memory allocation routines.
Debugging, floating point type and parameter definitions.
#define SPX_MSG_INCONSISTENT(name)
Row and columns Id's SPxLP.