170 for(
int j = 0; j < n; j++)
182 const int n = t.
size();
186 for(
int j = 0; j < n; ++j)
194 const int s =
size();
200 for(
int j = n + m; j < s; ++j)
262 ptrdiff_t
reMax(
int newMax = 1,
int newSize = -1)
281 const int n =
size();
289 for(i = 0; i < n && i < newSize; ++i)
290 new(&(newMem[i])) T(
data[i]);
293 for(; i < newMax; ++i)
294 new(&(newMem[i])) T();
297 ptrdiff_t pshift =
reinterpret_cast<char*
>(newMem) -
reinterpret_cast<char*
>(
data);
300 for(i =
themax - 1; i >= 0; --i)
318 const int n = rhs.
size();
322 for(
int i = 0; i < n; ++i)
334#ifdef ENABLE_CONSISTENCY_CHECKS
354 const int n =
size();
362 for(i = 0; i < n; ++i)
380 explicit ClassArray(
int p_size = 0,
int p_max = 0,
double p_fac = 1.2)
384 thesize = (p_size < 0) ? 0 : p_size;
396 for(
int i = 0; i < m; ++i)
407 for(
int i =
themax - 1; i >= 0; i--)
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.
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.
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.
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.
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_alloc(T &p, size_t n=1)
Allocate memory.
void spx_free(T &p)
Release memory.
Memory allocation routines.
Debugging, floating point type and parameter definitions.
#define SPX_MSG_INCONSISTENT(name)