ref<> Template

This is essentially a "smart pointer" reference-counting class. Instead of:

myclass* P = new myclass; // allocate a new instance of myclass
P->something (); // use it
delete P; // delete it, if you remember!

You now can just do:

ref< myclass > P = mkref (new myclass);
P->something();

YOU GET TO SKIP A WHOLE STEP! It will automatically handle deletion for you.

CAVEAT: it doesn't handle situations where one class is inside another which is inside the first class. For this, we really need garbadge collection, which isn't actually very plausable (IMHO) in C++.

AttachmentSize
ref.h4.35 KB