
/*****************************************************************************\

MODULE: ZZVec

SUMMARY:

The class ZZVec implements vectors of fixed-length ZZ's.
You can allocate a vector of ZZ's of a specified length, where
the maximum size of each ZZ is also specified.
These parameters can be specified once, either with a constructor,
or with SetSize.
It is an error to try to re-size a vector, or store a ZZ that
doesn't fit.
The space can be released with "kill", and then you are free to 
call SetSize again.
If you want more flexible---but less efficient---vectors, 
use vector(ZZ).

\*****************************************************************************/

#include "ZZ.h"


class ZZVec {
public:
   ZZVec();
   void operator=(const ZZVec&); 
   // first kill()'s destination (unless source and destination
   // are identical)
   ZZVec(const ZZVec&); 
   ~ZZVec();

   ZZVec(long n, long d);
   // sets length to n and max size of each element to d

   void SetSize(long n, long d);
   // sets length to n and max size of each element to d

   long length() const;
   // length of vector

   long BaseSize() const;
   // max size of each element

   void kill();
   // release space


   ZZ* elts();
   const ZZ* elts() const;
   // pointer to first element

   ZZ& operator[](long i);
   const ZZ& operator[](long i) const;
   // indexing operator; starts at 0; no range checking
};


void swap(ZZVec& x, ZZVec& y);
// swaps x and y by swapping pointers

