]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer std::vector to std::list. 3153/head
authorDavid Wells <wellsd2@rpi.edu>
Thu, 22 Sep 2016 22:59:13 +0000 (18:59 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 22 Sep 2016 22:59:13 +0000 (18:59 -0400)
When the only method we use is push_back there is no reason to use a
list instead of a vector.

source/base/parameter_handler.cc

index 7d92047a2a2d20d54ad51eca7f30975c73cbad89..75ced5878301d1b4b910722b3844d820f152f116 100644 (file)
@@ -31,7 +31,6 @@ DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
 #include <iomanip>
 #include <cstdlib>
 #include <algorithm>
-#include <list>
 #include <sstream>
 #include <cctype>
 #include <limits>
@@ -971,7 +970,7 @@ namespace Patterns
   bool MultipleSelection::match (const std::string &test_string_list) const
   {
     std::string tmp = test_string_list;
-    std::list<std::string> split_list;
+    std::vector<std::string> split_names;
 
     // first split the input list
     while (tmp.length() != 0)
@@ -993,13 +992,13 @@ namespace Patterns
         while (std::isspace (name[name.length()-1]))
           name.erase (name.length()-1, 1);
 
-        split_list.push_back (name);
+        split_names.push_back (name);
       };
 
 
     // check the different possibilities
-    for (std::list<std::string>::const_iterator test_string = split_list.begin();
-         test_string != split_list.end(); ++test_string)
+    for (std::vector<std::string>::const_iterator test_string = split_names.begin();
+         test_string != split_names.end(); ++test_string)
       {
         bool string_found = false;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.