#include "gccprefs.hh"
#include "output.hh"
#include "list.ht"
class X
{
public:
String s;
X()
{
s = "";
}
X(String s)
{
this->s = s;
}
X(const char* s)
{
this->s = s;
}
friend Writer& operator<<(Writer& w, const X& x)
{
w << x.s;
return w;
}
};
template class Node<X*>;
template class List<X*>;
template class Node<int>;
template class List<int>;
INSTANTIATE_OUTPUT_DEFINITION_STAR(X*);
INSTANTIATE_OUTPUT_DEFINITION(int);
#define TELL(x) do { cout << #x << endl; x; } while (false)
int main()
{
cout << "---Welcome to the program!\n";
List<X*>* l = new List<X*>();
l->add(new X("apple"));
l->add(new X("banana"));
l->add(new X("carrot"));
PRINT(*l);
PRINT(l->length());
l->OK();
l->reverse();
l->OK();
PRINT(l->length());
PRINT(*l);
l->first();
List<X*>* ll = new List<X*>();
ll->add(l->first()->current);
PRINT(*ll);
PRINT(*l);
TELL(delete l->first());
PRINT(*ll);
PRINT(*l);
TELL(l->first()->add(ll->first()->current));
PRINT(*ll);
PRINT(*l);
List<int>* li = new List<int>;
li->add(3);
li->add(4);
li->add(5);
PRINT(*li);
delete li->first();
PRINT(*li);
List<int>* li2 = new List<int>;
li2->add(li->first()->current);
PRINT(*li2);
}