Hi Folks,
still on the linked list problem...
how hazardous is the following code...i realize i do not have
copy/assignment defined and there is no exception handling...but was
wondering about the stl::list constructor and destructor.
i cannot inherit stl::list's ctor or dto - i think. Do not know how to
properly create/breakdown base class
any help greatly appreciated
Barry
// safeList.h
#ifndef SAFELIST_H
#define SAFELIST_H
using namespace std;
#include <list>
#include <iterator>
#include <memory>
#include <stdexcept>
//typedef list<T> S;
//typedef list<T>::iterator SI;
template<typename T>
class SafeList : private list<T> {
public:
SafeList() : list<T>() {}//No no-arg ctor not sure if i correctly
created an stl::list?
using list<T>::push_front;
using list<T>::size;
virtual ~SafeList() {}
private:
// SafeList(const SafeList&);
// SafeList& operator = (const SafeList&);
};
#endif
#include <iostream>
#include "safeList.h"
using namespace std;
int main()
{
SafeList<int> SL;
SL.push_front(10);
SL.push_front(20);
SL.push_front(30);
SL.push_front(40);
cout << "The size of the list is: " << SL.size() << endl;
//i think i should call ~stl::list<T>...not sure
}