// Partial listing of SPList
template <class T>
class SPList: private SPListBase<T>
{
public:
SPList(int sz= 10): SPListBase<T>(sz){}
//...
// make some SPListBase functions
// available to clients
T& operator[](const int i)
{return SPListBase<T>::operator[] (i); }
const T& operator[](const int i) const
{return SPListBase<T>::operator[] (i);}
SPListBase<T>::count; // some compilers don't like this
//...
// pop the next item off the top of the list
T pop(void)
{
T tmp;
int( n = count()-1;
if(n)=0){
tmp= {*this) [n];
compact (n);
}
return tmp;
}
// push the item onto the top of the list
void push(const T& a){ add(a);}
// shift the first itemoff the start of the list
T shift(void)
{
T tmp = (*this)[0];
compact (0);
return tmp;
}
// put the item onto the start of the list
int unshift(const T& a)
{
add(0, a);
return count();
}
//....
};
// End of File