]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix ParameterAcceptor 5290/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 20 Oct 2017 23:39:46 +0000 (01:39 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 20 Oct 2017 23:44:26 +0000 (01:44 +0200)
source/base/parameter_acceptor.cc

index 31441f92d6be28b29941d9965b5cffa5ae695f55..29efc99b2746444695cacad94e784161f9aae18c 100644 (file)
@@ -58,7 +58,7 @@ ParameterAcceptor::initialize(const std::string &filename,
   if (filename != "")
     {
       // check the extension of input file
-      if (filename.substr(filename.find_last_of(".") + 1) == "prm")
+      if (filename.substr(filename.find_last_of('.') + 1) == "prm")
         {
           try
             {
@@ -75,7 +75,7 @@ ParameterAcceptor::initialize(const std::string &filename,
                                             "We created it for you."));
             }
         }
-      else if (filename.substr(filename.find_last_of(".") + 1) == "xml")
+      else if (filename.substr(filename.find_last_of('.') + 1) == "xml")
         {
           std::ifstream is(filename);
           if (!is)
@@ -98,7 +98,7 @@ ParameterAcceptor::initialize(const std::string &filename,
     {
       std::ofstream outfile(output_filename.c_str());
       Assert(outfile, ExcIO());
-      std::string extension = output_filename.substr(output_filename.find_last_of(".") + 1);
+      std::string extension = output_filename.substr(output_filename.find_last_of('.') + 1);
 
       if ( extension == "prm")
         {
@@ -220,7 +220,7 @@ ParameterAcceptor::get_section_path() const
 void ParameterAcceptor::enter_my_subsection(ParameterHandler &prm=ParameterAcceptor::prm)
 {
   const auto sections = get_section_path();
-  for (auto sec : sections)
+  for (const auto &sec : sections)
     {
       prm.enter_subsection(sec);
     }
@@ -229,7 +229,7 @@ void ParameterAcceptor::enter_my_subsection(ParameterHandler &prm=ParameterAccep
 void ParameterAcceptor::leave_my_subsection(ParameterHandler &prm=ParameterAcceptor::prm)
 {
   const auto sections = get_section_path();
-  for (auto sec : sections)
+  for (const auto &sec : sections)
     {
       prm.leave_subsection();
     }

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.