classarray.h
Go to the documentation of this file.
35 * Class ClassArray provides safe arrays of general C++ objects (in contrast to data objects). The elements of an 36 * instance of ClassArray can be accessed just like ordinary C++ array elements by means of the index 40 * - checking of array bounds when accessing elements with the indexing operator[]() when compiled without \c -DNDEBUG 42 * Moreover, #ClassArray%s may easily be extended by #insert%ing or #append%ing elements to the ClassArray or shrunken 43 * by \ref remove() "removing" elements. Method reSize(int n) resets the ClassArray%s length to \p n thereby possibly 46 * A ClassArray may be used as arguments for standard C functions requiring pointers through the use of get_ptr() and 49 * Internally, a ClassArray object allocates a block of memory that fits up to max() elements, only size() of them are 63 /** When a ClassArray is reSize()%d to more than max() elements, the new value for max() is not just set to the new 64 * size but rather to \p memFactor * \p size. This makes #reSize%ing perform better in codes where a ClassArray is 214 /** Resizing a ClassArray to less than the previous size, involves discarding its last elements. Resizing to a larger 215 * value involves adding uninitialized elements (similar to append()). If neccessary, also memory will be 231 /** Even though the ClassArray currently holds no more than size() elements, up to max() elements could be added 240 /** The value of max() is reset to \p newMax thereby setting size() to \p newSize. However, if \p newSize has a value 241 * \c < \c 0 (as the default argument does) size() remains unchanged and max() is set to MIN(size(), newMax). Hence, 242 * calling reMax() without the default arguments, will reduce the memory consumption to a minimum. In no instance 245 * @return reMax returns the difference in bytes of the new and the old memory block, which can be used to update 350 /** The constructor allocates a ClassArray containing \p size uninitialized elements. The internal array is allocated
Memory allocation routines. void insert(int i, const ClassArray< T > &t) Inserts all elements from t before i 'th element. Definition: classarray.h:167 void insert(int i, int n, const T t[]) Inserts n elements from t before i 'the element. Definition: classarray.h:155 Safe arrays of class objects.Class ClassArray provides safe arrays of general C++ objects (in contras... Definition: classarray.h:55 Debugging, floating point type and parameter definitions. Everything should be within this namespace. ptrdiff_t reMax(int newMax=1, int newSize=-1) Resets maximum number of elements. Definition: classarray.h:248 void insert(int i, int n) Inserts n uninitialized elements before i 'th element. Definition: classarray.h:132 ClassArray(int p_size=0, int p_max=0, double p_fac=1.2) Default constructor. Definition: classarray.h:357 |