Re: When using Glib::RefPtr<> and when Pointer?



On 04/20/2009 05:13 PM, Andreas Volz wrote:
I'm a little confused about the Glib::RefPtr<>  usage in gtkmm.

For some returns are used smart pointers and for some normal pointers.
e.g.:

Gtk::ComboBox:
Glib::RefPtr<TreeModel>  	get_model ()

but

Gtk::Bin:
Widget* 	get_child ()

So why is a smart pointer used for get_model(), but not for
get_child(). Is there a reason behind? Could someone please explain
this?

get_child() return the widget that belongs to the other widget. There is not transfert of ownership. The only reason it return a pointer and not a reference is because it can be NULL.



Hub


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]