#ifndef ll
#define ll
template <class Atype>
class Node
{
	
	public:	
		Node();
		Node(Node&,const Atype&);
		~Node();
		void Link(Node&);
		void UnLink();
		Atype getValue(){return (value);}
      Atype * getValPtr() {return &value; } //D.W. good thing value isn't preiate!
	//private:
		Atype value;
		Node *previous;
		Node *next;
};
template <class Atype>
class iter;

//no usage of this class
//const_iterator class is so that conntent is not touchedd when iterating
template <class Atype>
class const_iterator
{
	public:
	const_iterator(){pointAt=0;}
	//const_iterator(const iter<Atype> & rhs) {copy(rhs);}
	//const_iterator(const const_iterator & rhs) {copy(rhs);}
	const_iterator(const Node<Atype>* target){pointAt =target;}
    
    ~const_iterator() {pointAt =0;} //this says dont delete pointAt!
	
	bool operator==(const const_iterator&) const;
	bool operator!=(const const_iterator& rhs) const{return(*this==rhs?false:true);}
	
	Atype operator*()const {return pointAt->getValue();}
	const Node<Atype> * operator->() const {return (pointAt);}
	
	const Node<Atype> * getPointAt()const  {return (pointAt);}
	
	const_iterator operator--()//prefix
	{
		const_iterator i(pointAt->previous);
		pointAt=pointAt->previous;
		return ( i);
	}
	const_iterator operator--(int)//postfix
	{
		const_iterator temp =*this;
		operator--();
		return temp;
	}
	const_iterator operator++()
	{
		const_iterator i(pointAt->next);
		pointAt=pointAt->next;
		return i;
	}
	const_iterator operator++(int)
	{
		const_iterator temp =*this;
		operator++();
		return temp;
	}
	
	private:
	iter<Atype> operator=(const const_iterator& rhs ){copy(rhs);}
	//void  copy(const iter<Atype> & rhs) {pointAt =  (rhs.getPointAt());}
	//void  copy(const const_iterator & rhs) {pointAt =& (rhs.pointAt);}
	const Node<Atype> * pointAt;
};

template <class Atype>
class iter
{
	public:
	iter(){pointAt=0;}
	//iter(const iter & rhs) {copy(rhs);}
	iter(Node<Atype> * target){pointAt =target;}
	
	~iter() {pointAt =0;} //this says dont delete pointAt!
	
	iter<Atype> operator=(const iter&){copy(rhs);}
	bool operator==(const iter&) const;
	bool operator!=(const iter& rhs) const{
	 return(*this==rhs?false:true);}
	Atype operator*(){return pointAt->getValue();}
	Node<Atype> * operator->(){return (pointAt);}
	
	
	iter operator--()//prefix
	{
		iter i(pointAt->previous);
		pointAt=pointAt->previous;
		return ( i);
	}
	iter operator--(int)//postfix
	{
		iter temp =*this;
		operator--();
		return temp;
	}
	iter operator++()
	{
		iter i(pointAt->next);
		pointAt=pointAt->next;
		return i;
	}
	iter operator++(int)
	{
		iter temp =*this;
		operator++();
		return temp;
	}
	Node<Atype> * getPointAt() {return pointAt;}
	
	private:
	void copy(const iter & rhs) {pointAt =rhs.pointAt;}
	Node<Atype> * pointAt;
};

#include "dll.cpp"
#endif
