From: Wolfgang Bangerth Date: Fri, 27 Oct 2017 18:47:38 +0000 (-0600) Subject: Simplify variadic constructors. X-Git-Tag: v9.0.0-rc1~858^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5342%2Fhead;p=dealii.git Simplify variadic constructors. --- diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 7f143c4303..d694d4e1b4 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1254,45 +1254,36 @@ namespace Patterns { template Tuple::Tuple(const char *separator, - const PatternTypes &... ps) : - separator(separator) - { - static_assert(is_base_of_all::value, - "Not all of the input arguments of this function " - "are derived from PatternBase"); - std::initializer_list pss = { &ps... }; - for (auto p : pss) - patterns.push_back(p->clone()); - } + const PatternTypes &... ps) + : + // simply forward to the std::string version + Tuple (std::string(separator), ps...) + {} template Tuple::Tuple(const std::string &separator, - const PatternTypes &... ps) : - separator(separator) + const PatternTypes &... ps) + : + separator (separator) { static_assert(is_base_of_all::value, "Not all of the input arguments of this function " "are derived from PatternBase"); - std::initializer_list pss = { &ps... }; - for (auto p : pss) - patterns.push_back(p->clone()); + auto pattern_pointers = { (static_cast(&ps))... }; + for (auto p : pattern_pointers) + patterns.push_back (p->clone()); } template - Tuple::Tuple(const PatternTypes &... ps) : - separator(",") - { - static_assert(is_base_of_all::value, - "Not all of the input arguments of this function " - "are derived from PatternBase"); - std::initializer_list pss = { &ps... }; - for (auto p : pss) - patterns.push_back(p->clone()); - } + Tuple::Tuple(const PatternTypes &... ps) + : + // forward to the version with the separator argument + Tuple (std::string(","), ps...) + {}