A smartpointer acts much like a normal pointer. Here are a few examples.
You can copy RefPtrs, just like normal pointers. But unlike
normal pointers, you don't need to worry about deleting the underlying
instance
Glib::RefPtr<Gdk::Bitmap> refBitmap = Gdk::Bitmap::create(window,
data, width, height);
Glib::RefPtr<Gdk::Bitmap> refBitmap2 = refBitmap;
Of course this means that you can store RefPtrs in standard
containers, such as std::vector or std::list.
std::list< Glib::RefPtr<Gdk::Pixmap> > listPixmaps;
Glib::RefPtr<Gdk::Pixmap> refPixmap = Gdk::Pixmap::create(window,
width, height, depth);
listPixmaps.push_back(refPixmap);