Glib::RefPtr vs std::shared_ptr

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Glib::RefPtr vs std::shared_ptr

Compro Prasad
What is the difference between Glib::RefPtr and std::shared_ptr?

Given I read:
https://softwareengineering.stackexchange.com/questions/206223/gtkmm-manage-add-vs-smart-pointers#230883

I still want to confirm that whether Glib::RefPtr is better than
std::shared_ptr .

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Glib::RefPtr vs std::shared_ptr

Daniel Boles
RefPtr in the current stable glibmm family is an intrusive refcounting smart pointer, i.e. it uses GObject refcounting.

In unstable, it is an alias to shared_ptr, so it uses a different layer of C++ refcounting instead of GObject.

As for which is better, I guess the above answers that too.

Btw, neither relates to Gtk::manage(), which is about letting containers manage the lifetime of their children, i.e. restoring the floating reference semantics that widgets have by default in GTK+ but not in gtkmm. RefPtr is not used with widgets.

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list