/** 
 * This is a sample fix to one of the section exercises. IntArrayList would also
 * have to be fixed accordingly.
 */

#include <cstdlib>
#include "./IntArrayList.h"

class Wrap {
  public:
    Wrap() : p_(nullptr) {}
    Wrap(IntArrayList *p) : p_(p) { *p_ = *p; }
    IntArrayList *p() const { return p_; }
  private:
    IntArrayList *p_;
};

struct List {
  IntArrayList v;
};

int main() {
  Wrap a;
  IntArrayList *tmp = new IntArrayList;
  Wrap b(tmp); 
  struct List c { }; 
  struct List d { *b.p() }; 
  a = b;  
  c = d;  
  Wrap *e;
  e = &a; 
  Wrap *f = new Wrap(&d.v); 
  struct List *g = new struct List; 
  delete tmp;
  tmp = new IntArrayList;
  g->v = *tmp; 
  delete f;
  delete g;
  delete tmp;
  return 0;
}