September 1999
Intermediate to advanced
256 pages
7h 38m
English
The following is a complete listing of the C++ integer set representation classes discussed in Column 13. The complete code can be found at this book’s web site.
class IntSetSTL {private: set<int> S;public: IntSetSTL(int maxelms, int maxval) { } int size() { return S.size(); } void insert(int t) { S.insert(t);} void report(int *v) { int j = 0; set<int>::iterator i; for (i = S.begin(); i != S.end(); ++i) v[j++] = *i; }};
class IntSetArray {private: int n, *x;public: IntSetArray(int maxelms, int maxval) { x = new int[l + maxelms]; n = 0; x[0] = maxval; } int size() { return ...
Read now
Unlock full access