[gtkmm-documentation/wip/dboles/no-new: 2/2] docb: Don't recommend `new` for an in-class member
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation/wip/dboles/no-new: 2/2] docb: Don't recommend `new` for an in-class member
- Date: Sun, 24 Nov 2019 19:39:22 +0000 (UTC)
commit 2ed6330256812daff32f533521282e527b35abdf
Author: Daniel Boles <dboles src gmail com>
Date: Sun Nov 24 19:32:08 2019 +0000
docb: Don't recommend `new` for an in-class member
Instead, recommend an std::unique_ptr, which will destroy it via RAII,
rather than requiring that the user remember to `delete` it and have to
define a non-trivial destructor just to do that, which is just busywork.
docs/tutorial/C/index-in.docbook | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/docs/tutorial/C/index-in.docbook b/docs/tutorial/C/index-in.docbook
index 1fc1093..5270c9f 100644
--- a/docs/tutorial/C/index-in.docbook
+++ b/docs/tutorial/C/index-in.docbook
@@ -3563,7 +3563,7 @@ mouse button.
m_refBuilder->add_from_string(ui_info);
auto gmenu = m_refBuilder->get_object<Gio::Menu>("menu-examplepopup");
-m_pMenuPopup = new Gtk::Menu(gmenu);]]>
+m_pMenuPopup = std::make_unique<Gtk::Menu>(gmenu);]]>
</programlisting>
<para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]