On 23 February 2018 at 14:55, Pavlo Solntsev wrote:

> Daniel,
>
> now it is clear. I didn't and still don't understand exactly how internal
> data members are represented in the generated class (I have no access to my
> code now) but the situation I have by returning a reference is clear. BTW
> does it make sense to think about shared_ptr as returned value for getter?
>


No, because unless you keep a copy of the shared_ptr as a member, you will
get a new shared_ptr each time you call it, which doesn't share ownership
with the previous ones.

So now you have the shared_ptr overhead (reference counting) and
inconvenience (needing to use operator* to access the value), without any
sharing.

You might as well just return by value, or have a Glib::ustring member.
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to