Copiado

Puede copiar RefPtr como punteros normales. Pero, a diferencia de los punteros normales, no necesita preocuparse por la eliminación de la instancia subyacente.

auto refPixbuf = Gdk::Pixbuf::create_from_file(filename);
auto refPixbuf2 = refPixbuf;

Por supuesto esto significa que puede almacenar RefPtr en contenedores estándar, como std::vector o std::list.

std::list<Glib::RefPtr<Gdk::Pixbuf>> listPixbufs;
auto refPixbuf = Gdk::Pixbuf::create_from_file(filename);
listPixbufs.push_back(refPixbuf);