The RefPtr smartpointer
Glib::RefPtr is a smartpointer. Specifically, it is a reference-counting smartpointer. You might be familiar with std::auto_ptr<>, which is also a smartpointer, but Glib::RefPtr<> is much simpler, and more useful. We expect a future version of the C++ Standard Library to contain a reference-counting shared smartpointer, and a future version of gtkmm might possibly use that instead.
A smartpointer acts much like a normal pointer. Here are a few examples.
- A.1. Copying
- A.2. Dereferencing
- A.3. Casting
- A.4. Checking for null
- A.5. Constness