/* CSE 333 Su12 lecture 13 demo: strongcycle.cc */
/* Gribble/Perkins */

// A weakness of reference counting: a data structure that contains a
// cycle will have objects whose reference count is non-zero even if
// the data is no longer being used.  That prevents automatic deletion
// of the data.

#include <boost/shared_ptr.hpp>

using boost::shared_ptr;

class A {
 public:
  shared_ptr<A> next;
  shared_ptr<A> prev;
};

int main(int argc, char **argv) {
  shared_ptr<A> head(new A());
  head->next = shared_ptr<A>(new A());
  head->next->prev = head;

  return 0;
}