El puntero inteligente RefPtr
Glib::RefPtr is a smartpointer. Specifically, it is a reference-counting smartpointer. You might be familiar with std::auto_ptr<>, std::unique_ptr<> and std::shared_ptr<>, which are also smartpointers. Glib::RefPtr<> is similar to std::shared_ptr<>, which is also reference-counting. Glib::RefPtr<> was introduced long before there was a reference-counting smartpointer in the C++ Standard Library.
Un puntero inteligente actúa como un puntero normal. Aquí hay algunos ejemplos.
- A.1. Copiado
- A.2. Eliminar referencia
- A.3. Conversión de tipos
- A.4. Verificar si es nulo
- A.5. Constancia