I don’t think it's practical to use shared_ptr
for widgets if you don't need to keep a reference to that widget after you add it. You are better off having a managed widget instead using shared_ptr
.
The nice thing about the gtk::manage is that you can create the object on the heap and add it to the container and forget about it, and when that container is destroyed it will destroy the widget.
As a general rule I create my widgets managed if I don't need to reference them after I add them to a container, if I do need to reference them, I allocate a pointer.