170 for(
int j = 0; j < n; j++)
182 for(
int j = 0; j < t.
size(); j++)
193 assert(n + m <=
size());
195 for(
int j = n + m; j <
size(); j++)
257 ptrdiff_t
reMax(
int newMax = 1,
int newSize = -1)
283 for(i = 0; i <
size() && i < newSize; i++)
284 new(&(newMem[i])) T(
data[i]);
287 for(; i < newMax; i++)
288 new(&(newMem[i])) T();
291 ptrdiff_t pshift =
reinterpret_cast<char*
>(newMem) -
reinterpret_cast<char*
>(
data);
294 for(i =
themax - 1; i >= 0; i--)
314 for(
int i = 0; i <
size(); i++)
326#ifdef ENABLE_CONSISTENCY_CHECKS
352 for(i = 0; i <
size(); i++)
356 for(; i <
max(); i++)
370 explicit ClassArray(
int p_size = 0,
int p_max = 0,
double p_fac = 1.2)
374 thesize = (p_size < 0) ? 0 : p_size;
384 for(
int i = 0; i <
max(); i++)
395 for(
int i =
themax - 1; i >= 0; i--)
Safe arrays of class objects.
bool isConsistent() const
Consistency check.
T & operator[](int n)
Reference to n 'th element.
ClassArray & operator=(const ClassArray &rhs)
Assignment operator.
T * get_ptr()
Gets a C pointer to the data.
void append(int n, const T t[])
Appends n elements from t.
int themax
the length of array data and
void insert(int i, const ClassArray< T > &t)
Inserts all elements from t before i 'th element.
ClassArray(const ClassArray &old)
Copy constructor.
void append(const ClassArray< T > &t)
Appends all elements from t.
const T & last() const
Reference to last const element.
int max() const
Returns maximum number of elements.
const T * get_const_ptr() const
Gets a const C pointer to the data.
void insert(int i, int n)
Inserts n uninitialized elements before i 'th element.
int thesize
number of used elements in array data
ptrdiff_t reMax(int newMax=1, int newSize=-1)
Resets maximum number of elements.
void reSize(int newsize)
Resets size to newsize.
void removeLast(int m=1)
Removes m last elements.
void append(const T &t)
Appends element t.
T * data
the array of elements
void clear()
Removes all elements.
const T & operator[](int n) const
Reference to n 'th const element.
ClassArray(int p_size=0, int p_max=0, double p_fac=1.2)
Default constructor.
double memFactor
memory extension factor.
void insert(int i, int n, const T t[])
Inserts n elements from t before i 'the element.
void remove(int n=0, int m=1)
Removes m elements starting at n.
virtual ~ClassArray()
Destructor.
T & last()
Reference to last element.
int size() const
Returns number 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.
Memory allocation routines.
Debugging, floating point type and parameter definitions.
#define SPX_MSG_INCONSISTENT(name)