[gnote] Use move semantics when adding note



commit 4e57077d06bd1bf1b8f18c252e67be5e22987f0a
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Dec 23 17:22:27 2019 +0200

    Use move semantics when adding note

 src/notemanagerbase.cpp | 4 ++--
 src/notemanagerbase.hpp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/notemanagerbase.cpp b/src/notemanagerbase.cpp
index 6ea9e642..f564bd41 100644
--- a/src/notemanagerbase.cpp
+++ b/src/notemanagerbase.cpp
@@ -189,12 +189,12 @@ NoteBase::List NoteManagerBase::get_notes_linking_to(const Glib::ustring & title
   return result;
 }
 
-void NoteManagerBase::add_note(const NoteBase::Ptr & note)
+void NoteManagerBase::add_note(NoteBase::Ptr note)
 {
   if(note) {
     note->signal_renamed.connect(sigc::mem_fun(*this, &NoteManagerBase::on_note_rename));
     note->signal_saved.connect(sigc::mem_fun(*this, &NoteManagerBase::on_note_save));
-    m_notes.push_back(note);
+    m_notes.push_back(std::move(note));
   }
 }
 
diff --git a/src/notemanagerbase.hpp b/src/notemanagerbase.hpp
index 334936b3..ff5941fd 100644
--- a/src/notemanagerbase.hpp
+++ b/src/notemanagerbase.hpp
@@ -106,7 +106,7 @@ protected:
   virtual void post_load();
   virtual void migrate_notes(const Glib::ustring & old_note_dir);
   /** add the note to the manager and setup signals */
-  void add_note(const NoteBase::Ptr &);
+  void add_note(NoteBase::Ptr);
   void on_note_rename(const NoteBase::Ptr & note, const Glib::ustring & old_title);
   void on_note_save(const NoteBase::Ptr & note);
   virtual NoteBase::Ptr create_note_from_template(const Glib::ustring & title,


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