]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid clone()
authorDaniel Arndt <arndtd@ornl.gov>
Mon, 8 Feb 2021 19:59:43 +0000 (14:59 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Mon, 8 Feb 2021 19:59:43 +0000 (14:59 -0500)
include/deal.II/base/parameter_handler.h
include/deal.II/base/patterns.h

index 69eed03a24884a4e69651f5b0e70e8da67574d3a..ec0a32bbdc5c62fb0baf18ed93966974aebf134c 100644 (file)
@@ -2333,8 +2333,8 @@ ParameterHandler::add_parameter(const std::string &          entry,
                 "that is const. Use a non-const type.");
 
   declare_entry(entry,
-                Patterns::Tools::Convert<ParameterType>::to_string(
-                  parameter, *pattern.clone()),
+                Patterns::Tools::Convert<ParameterType>::to_string(parameter,
+                                                                   pattern),
                 pattern,
                 documentation,
                 has_to_be_set);
@@ -2345,7 +2345,7 @@ ParameterHandler::add_parameter(const std::string &          entry,
 
   auto action = [&, pattern_index](const std::string &val) {
     parameter = Patterns::Tools::Convert<ParameterType>::to_value(
-      val, *patterns[pattern_index]->clone());
+      val, patterns[pattern_index]);
   };
   add_action(entry, action);
 }
index d9a8d1e4eb966524f17763979554389e6a454bfa..df712ca77ecdabc4b91097282847b360e1724b4b 100644 (file)
@@ -2292,7 +2292,7 @@ namespace Patterns
       {
         std::array<std::string, std::tuple_size<T>::value> a = {
           {Convert<typename std::tuple_element<U, T>::type>::to_string(
-            std::get<U>(t), *pattern.get_pattern(U).clone())...}};
+            std::get<U>(t), pattern.get_pattern(U))...}};
         return a;
       }
 
@@ -2311,7 +2311,7 @@ namespace Patterns
       {
         return std::make_tuple(
           Convert<typename std::tuple_element<U, T>::type>::to_value(
-            s[U], *pattern.get_pattern(U).clone())...);
+            s[U], pattern.get_pattern(U))...);
       }
 
       static T

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.