Use std::vector for add_files.
authorCarl Hetherington <cth@carlh.net>
Mon, 21 Jun 2021 21:55:05 +0000 (23:55 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 21 Jun 2021 21:55:05 +0000 (23:55 +0200)
src/wx/content_panel.cc
src/wx/content_panel.h

index d1859b894e1c34a8f391ed7dc0c19b9daedf2ade..68f6f1b9479686ff88460147cef27229d806a258 100644 (file)
@@ -441,9 +441,9 @@ ContentPanel::add_file_clicked ()
 
        wxArrayString paths;
        d->GetPaths (paths);
-       list<boost::filesystem::path> path_list;
+       vector<boost::filesystem::path> path_list;
        for (unsigned int i = 0; i < paths.GetCount(); ++i) {
-               path_list.push_back (wx_to_std (paths[i]));
+               path_list.push_back (wx_to_std(paths[i]));
        }
        add_files (path_list);
 
@@ -788,9 +788,9 @@ ContentPanel::files_dropped (wxDropFilesEvent& event)
        }
 
        auto paths = event.GetFiles ();
-       list<boost::filesystem::path> path_list;
+       vector<boost::filesystem::path> path_list;
        for (int i = 0; i < event.GetNumberOfFiles(); i++) {
-               path_list.push_back (wx_to_std (paths[i]));
+               path_list.push_back (wx_to_std(paths[i]));
        }
 
        add_files (path_list);
@@ -798,14 +798,14 @@ ContentPanel::files_dropped (wxDropFilesEvent& event)
 
 
 void
-ContentPanel::add_files (list<boost::filesystem::path> paths)
+ContentPanel::add_files (vector<boost::filesystem::path> paths)
 {
        /* It has been reported that the paths returned from e.g. wxFileDialog are not always sorted;
           I can't reproduce that, but sort them anyway.  Don't use ImageFilenameSorter as a normal
           alphabetical sort is expected here.
        */
 
-       paths.sort (CaseInsensitiveSorter ());
+       std::sort (paths.begin(), paths.end(), CaseInsensitiveSorter());
 
        /* XXX: check for lots of files here and do something */
 
index aca8181184b596c7d02b2c9391f3bd984f9b0f6e..e25dedceabc94064de40e7386361cfed4d428b41 100644 (file)
@@ -126,7 +126,7 @@ private:
        void setup ();
        void setup_sensitivity ();
 
-       void add_files (std::list<boost::filesystem::path>);
+       void add_files (std::vector<boost::filesystem::path>);
        std::list<ContentSubPanel *> panels () const;
 
        LimitedSplitter* _splitter;