From: Wolfgang Bangerth Date: Tue, 25 Apr 2017 17:51:39 +0000 (-0600) Subject: Simplify memory management in Patterns::List/Map. X-Git-Tag: v9.0.0-rc1~1644^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c18314e94b8332dea708e0967041552df8a16ea;p=dealii.git Simplify memory management in Patterns::List/Map. --- diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index 3eb4225351..1b5867af30 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -419,11 +419,6 @@ namespace Patterns */ List (const List &other); - /** - * Destructor. - */ - virtual ~List (); - /** * Return true if the string is a comma-separated list of strings * each of which match the pattern given to the constructor. @@ -473,7 +468,7 @@ namespace Patterns /** * Copy of the pattern that each element of the list has to satisfy. */ - PatternBase *pattern; + std::unique_ptr pattern; /** * Minimum number of elements the list must have. @@ -539,11 +534,6 @@ namespace Patterns */ Map (const Map &other); - /** - * Destructor. - */ - virtual ~Map (); - /** * Return true if the string is a comma-separated list of strings * each of which match the pattern given to the constructor. @@ -594,8 +584,8 @@ namespace Patterns * Copy of the patterns that each key and each value of the map has to * satisfy. */ - PatternBase *key_pattern; - PatternBase *value_pattern; + std::unique_ptr key_pattern; + std::unique_ptr value_pattern; /** * Minimum number of elements the list must have. diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index d1c613e77f..7bf9f1edc9 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -597,14 +597,6 @@ namespace Patterns - List::~List () - { - delete pattern; - pattern = nullptr; - } - - - bool List::match (const std::string &test_string_list) const { std::string tmp = test_string_list; @@ -788,17 +780,6 @@ namespace Patterns - Map::~Map () - { - delete key_pattern; - key_pattern = nullptr; - - delete value_pattern; - value_pattern = nullptr; - } - - - bool Map::match (const std::string &test_string_list) const { std::string tmp = test_string_list;