template class Set { private: T *arr; int length; int pos; public: Set(void); ~Set(void); void addVal(const T&); void printVec(void); void insertSort(void); Set unionSet(Set); int getLength(); int getPos(); }; template Set ::Set(void) { length = 50; pos = 0; arr = new T[length]; } template Set ::~Set(void) { delete [] arr; } template void Set::addVal(const T &value) { int i; T *temp; T tval; /*//Resize as needed if(pos == length-1){ temp = new T[length+10]; for(i=0; i void Set::insertSort(void){ int i, j; T index; for (i=0; i < pos; i++){ index = arr[i]; j = i; while ((j > 0) && (arr[j-1] > index)){ arr[j] = arr[j-1]; j = j - 1; } arr[j] = index; } } template void Set::printVec(void){ int i; if(pos < 0){ cout << "There are no values in Vector!" << endl; }else{ for(i=0; i < pos; i++){ cout << arr[i] << " "; } cout << endl; } } template Set Set :: unionSet(Set x){ Set *temp = new Set(); temp = x; for(i=0; i < pos; i++){ temp->addVal(arr[i]); } return temp; } template int Set :: getLength(void){return length;} template int Set :: getPos(void){return pos;}