Uses for passing RefPtr as const&

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Uses for passing RefPtr as const&

Daniel Boles
In some cases when a signal handler takes a RefPtr const&, it only ever needs to observe the object, so it would seem simpler to pass a normal const& reference. What's the normal reason for passing a RefPtr const&?

To me it would express 'This thing is reference counted, and you can add a reference if you want, but I'm not going to make you (i.e. waste an increment/decrement just for every call)'. However, this doesn't always seem to be the case, as in a number of handlers I've seen, there appears to be no reason that the callee would take a reference.

Sorry if this is a silly question, but it popped into my head, so I thought I'd better write it down...

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