30int IdxSet::dim()
const
34 for(
int i = 0; i <
size(); i++)
41int IdxSet::pos(
int i)
const
43 for(
int n = 0; n <
size(); n++)
50void IdxSet::add(
int n,
const int i[])
52 assert(n >= 0 &&
size() + n <=
max());
54 for(
int j = 0; j < n; j++)
60void IdxSet::remove(
int n,
int m)
62 assert(n <= m && m <
size() && n >= 0);
66 int newnum =
num - cpy;
67 cpy = (
size() - m >= cpy) ? cpy :
size() - m;
126bool IdxSet::isConsistent()
const
128#ifdef ENABLE_CONSISTENCY_CHECKS
131 if(
len > 0 &&
idx ==
nullptr)
134 for(i = 0; i <
size(); ++i)
139 for(j = 0; j < i; j++)
bool freeArray
true iff idx should be freed inside of this object
bool isConsistent() const
consistency check.
int max() const
returns the maximal number of indices which can be stored in IdxSet.
int num
number of used indices
int index(int n) const
access n 'th index.
int * idx
array of indices
void add(int n)
appends n uninitialized indices.
int size() const
returns the number of used indices.
int len
length of array idx
Everything should be within this namespace.
void spx_free(T &p)
Release memory.
void spx_alloc(T &p, int n=1)
Allocate memory.
#define SPX_MSG_INCONSISTENT(name)