[gnote] Replace std::list with std::vector for Note::List



commit 3e2cc380ef1d2c46fc780ef4dcc481011672ac98
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Apr 28 17:52:09 2019 +0300

    Replace std::list with std::vector for Note::List

 src/note.cpp       | 6 ++----
 src/note.hpp       | 5 ++---
 src/notewindow.cpp | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/src/note.cpp b/src/note.cpp
index 82c0d8ee..c2cf9c66 100644
--- a/src/note.cpp
+++ b/src/note.cpp
@@ -46,7 +46,7 @@ namespace gnote {
 
   namespace noteutils {
 
-    void show_deletion_dialog (const std::list<Note::Ptr> & notes, Gtk::Window * parent)
+    void show_deletion_dialog(const Note::List & notes, Gtk::Window * parent)
     {
       Glib::ustring message;
 
@@ -80,9 +80,7 @@ namespace gnote {
 
       int result = dialog.run();
       if (result == 666) {
-        for(Note::List::const_iterator iter = notes.begin();
-            iter != notes.end(); ++iter) {
-          const Note::Ptr & note(*iter);
+        for(auto & note : notes) {
           note->manager().delete_note(note);
         }
       }
diff --git a/src/note.hpp b/src/note.hpp
index 20058bfa..2ee3c2ae 100644
--- a/src/note.hpp
+++ b/src/note.hpp
@@ -24,7 +24,6 @@
 #ifndef __NOTE_HPP_
 #define __NOTE_HPP_
 
-#include <list>
 #include <queue>
 
 #include <gtkmm/textbuffer.h>
@@ -92,7 +91,7 @@ class Note
 public:
   typedef std::shared_ptr<Note> Ptr;
   typedef std::weak_ptr<Note> WeakPtr;
-  typedef std::list<Ptr> List;
+  typedef std::vector<Ptr> List;
 
   ~Note();
 
@@ -217,7 +216,7 @@ private:
 };
 
 namespace noteutils {
-  void show_deletion_dialog (const std::list<Note::Ptr> & notes, Gtk::Window * parent);
+  void show_deletion_dialog(const Note::List & notes, Gtk::Window * parent);
 }
 
 }
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index ed2eff9a..0b7e87cf 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -352,7 +352,7 @@ namespace gnote {
   void NoteWindow::on_delete_button_clicked(const Glib::VariantBase&)
   {
     // Prompt for note deletion
-    std::list<Note::Ptr> single_note_list;
+    Note::List single_note_list;
     single_note_list.push_back(std::static_pointer_cast<Note>(m_note.shared_from_this()));
     noteutils::show_deletion_dialog(single_note_list, dynamic_cast<Gtk::Window*>(host()));
   }


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