ivutils
|
class for controlling one-dimensional data arrays of type T the array can be managed and copied by reference (ref counting used) compatible with vector<T> used as container More...
#include <pencil.h>
Public Member Functions | |
pencil (int snmax=0, int sn=0) | |
size of container (actual elements number) | |
pencil (container_arg< container_t > arg, int snmax, int sn=0, int managed=0) | |
Constructor form existing container. | |
pencil (container_it first, container_it last, int snmax) | |
creates unmanaged reference to the sequence | |
int | resize (int newnmax, int newn=-1, const T &t=T()) |
resizes the data: if newnmax==0, dereferences the old array if newnmax<=nmax, keeps the old one if newnmax>nmax dereferences the old array, allocates new, changes to master mode | |
pencil (const pencil &other) | |
copy constructor | |
pencil & | operator= (const pencil &other) |
reference copy | |
pencil & | copy_data (const pencil &other, int mode=0) |
copies data from other pencil mode=0: if this size is too small, creates new reference data! in which case other referring pencils will not be updated mode=1: if this size is too small, copies the first portion of the data only | |
container_it | get_ptr () const |
same as begin(), retained for compatibility | |
int | shift_arr (int ind, int num) |
shifts array by num elements starting from ind | |
int | num_copies () |
gets the number of copies | |
Public Attributes | |
int | n |
capacity of container | |
class for controlling one-dimensional data arrays of type T the array can be managed and copied by reference (ref counting used) compatible with vector<T> used as container
|
inline |
Constructor form existing container.
Container pointer is to be used as the first argument, f.e. T* in case of pointer container or vector<T> * in case of vector container Container_arg makes the proper argument conversion if managed=0 will not delete ptr, 1-deletes, 2-makes a copy of sn elements and does not remember ptr