template<typename T>class BasicList
  {
public:
 Â
                    BasicList() {}
                    BasicList(BasicList&src) {Copy(items,src.items);}
                    ~BasicList() {}
  BasicList        operator=(BasicList&);
 Â
  T                operator[](int i) {return Get(i);}
  T                Get(int at) {int c=Count(); if(c>0&&at>=0&&at<c) {return items[at];} return NULL;}
  T                First() {int c=Count(); if(c>0) {return items[0];} return NULL;}
  T                Last() {int c=Count(); if(c>0) {return items[c-1];} return NULL;}
 Â
  int              Count() {return ArraySize(items);}
  int              Find(T item) {int c=Count(); for(int i=0; i<c; i++) {if(item==items[i]) {return i;}} return -1;}
  void              Print() {int c=ArraySize(items); for(int i=0; i<c; i++) {PrintFormat("%d:%s",i,(string)items[i]);}}
 Â
  void              operator+=(T item) {Append(item);}
  void              operator^=(T item) {Prepend(item);}
  void              Append(T item) {int c=ArraySize(items); IncreaseAt(c); items[c]=item;}
  void              Prepend(T item) {IncreaseAt(0); items[0]=item;}
 Â
  void              operator-=(T item) {Remove(item);}
  void              operator~() {RemoveAll();}
  void              Remove(T item) {int f=Find(item); if(f>-1) {ReduceAt(f);}}
  void              RemoveLast() {ReduceAt(ArraySize(items)-1);}
  void              RemoveFirst() {ReduceAt(0);}
  void              RemoveAll() {ArrayFree(items);}
 Â
  T                Top() {return Last();}
  void              Push(T item) {Append(item);}
  T                Pop() {T top=Top(); RemoveLast(); return top;}
protected:
  T                items[];
 Â
  void              ReduceAt(int);
  void              IncreaseAt(int);
  void              Copy(T&dst[],T&src[]) {int c=ArraySize(src); ArrayResize(dst,c); for(int i=0; i<c; i++) {dst[i]=src[i];}}
  };
void OnStart()
  {
  BasicList<string>list;
 Â
  list+="worry";               Â
  list+="be happy";           Â
  list.Print();               Â
 Â
    {string s; for(int i=0; i<10; i++) {s+="-";} Print(s);}
 Â
  list^="don't";               Â
  BasicList<string>list2=list; Â
  list2.Print();               Â
 Â
    {string s; for(int i=0; i<10; i++) {s+="-";} Print(s);}
 Â
  ~list;                       Â
  Print(list2.Pop());         Â
 Â
    {string s; for(int i=0; i<10; i++) {s+="-";} Print(s);}
 Â
  list2.Print();               Â
  }