Here's my .h file:

Code:

#ifndef LIST_H
#define LIST_H
template < typename T > class List
{
public:
List() : head( new Node( T() ) ), tail( new Node( T() ) ) {}
List( const List& src ) : head( new Node( T() ) ), tail( new Node( T() ) )
{
clear();
for( Node* temp = ( src.head )->next; temp != src.tail; temp = temp->next )
{
pushb( temp->data ) ;
}
}
~List()
{
clear();
delete head;
delete tail;
}
class Iterator;
Iter begin(){ return Iter(head); }
Iter end(){ return Iter(tail); }
/* INTERFACE:
*/
bool empty();
unsigned int size();
int sorted();
bool prox( const T& );
void makef( const T& );
void pushf( const T& );
void pushb( const T& );
void popf();
void popb();
void insert( const T& );
void revins( const T& );
void ins( const T& );
void remove( const T& );
void revrem( const T& );
void rem( const T& );
void remall( const T& );
void dis();
void revdis();
void sort();
void revsort();
void rev();
bool search( const T& );
void consearch( const T& );
void clear();
private:
class Node;
Node *head, *tail;
};
template <typename T> class List<T>::Iterator{
public:
Iterator(Node* p) : Node_(p) {}
~Iterator() {}
Iterator& operator=(const Iterator& other)
{
Node_ = other.Node_;
return(*this);
}
Iterator& operator++()
{
if (Node_ != NULL)
{
Node_ = Node_->next_;
}
return(*this);
}
Iterator& operator++(int)
{
Iterator tmp(*this);
++(*this);
return(tmp);
}
// Node directly.
T& operator*()
{
return(Node_->getVal());
}
private:
Node* Node_;
};
template <typename T> class List<T>::Node{
public:
Node( const T& x, Node* y = 0, Node* z = 0 ) : data( x ), prev( y ), next( z ) {}
Node( const Node& src ) : data( src.data ), prev( src.prev ), next( src.next ) {}
const T getVal(){ return data; }
private:
T data;
Node *prev, *next;
};
#endif