-
- // PICKING APART
- // These accessors can be used to get the pieces of the value
- Index getCapacity() const { return cap; }
- Index getLength() const { return len; }
- Blk getBlock(Index i) const { return blk[i]; };
- bool isEmpty() const { return len == 0; }
-
- // Equality comparison: checks if arrays have same length and matching values
- // Derived classes may wish to override these if differing arrays can
- // sometimes be considered equivalent.
+
+ /* Ensures that the array has at least the requested capacity; may
+ * destroy the contents. */
+ void allocate(Index c);
+
+ /* Ensures that the array has at least the requested capacity; does not
+ * destroy the contents. */
+ void allocateAndCopy(Index c);
+
+ // Copy constructor
+ NumberlikeArray(const NumberlikeArray<Blk> &x);
+
+ // Assignment operator
+ void operator=(const NumberlikeArray<Blk> &x);
+
+ // Constructor that copies from a given array of blocks
+ NumberlikeArray(const Blk *b, Index blen);
+
+ // ACCESSORS
+ Index getCapacity() const { return cap; }
+ Index getLength() const { return len; }
+ Blk getBlock(Index i) const { return blk[i]; }
+ bool isEmpty() const { return len == 0; }
+
+ /* Equality comparison: checks if both objects have the same length and
+ * equal (==) array elements to that length. Subclasses may wish to
+ * override. */