#include <iostream>

#include <cstdlib>



#include "./ToyPtr.h"



// Simple struct to illustrate "->" operator.

struct Point { int x = 1, y = 2; };

std::ostream &operator<<(std::ostream &out, const Point &rhs) {

  return out << "(" << rhs.x << "," << rhs.y << ")";

}



int main(int argc, char **argv) {

  // Create a dumb pointer.

  Point *leak = new Point;



  // Create a "smart" pointer.  (OK, it's still pretty dumb.)

  ToyPtr<Point> notleak(new Point);

  // Use them.

  std::cout << "     *leak: " << *leak << std::endl;

  std::cout << "   leak->x: " << leak->x << std::endl;

  std::cout << "  *notleak: " << *notleak << std::endl;

  std::cout << "notleak->x: " << notleak->x << std::endl;



  // Return, leaking "leak" but not "notleak".

  return EXIT_SUCCESS;

}