From 459947d08d6a15522b223599edcf78eb32b8a6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Wed, 29 Oct 2014 20:16:20 +0100 Subject: [PATCH] [cleanup] Unify addCriterion methods. Now theres only a single addCriterion methods passing all its arguments to the Criterion constructor (by means of perfect forwarding). --- dune/solvers/solvers/loopsolver.hh | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/dune/solvers/solvers/loopsolver.hh b/dune/solvers/solvers/loopsolver.hh index d1b1800c..6b7e854c 100644 --- a/dune/solvers/solvers/loopsolver.hh +++ b/dune/solvers/solvers/loopsolver.hh @@ -47,25 +47,6 @@ public: */ virtual void check() const; - - /** - * \brief Add a convergence criterion - * - * All criteria are checked after each loop. The solver loop will - * terminate once any of the supplied criteria evaluates to true. - * If you want to terminate only if several criteria are true - * you can combine criteria using the overloaded bitwise - * logical operations. - * - * Besides checking the criterion the LoopSolver will - * print the diagnostic string returned by the criterion - * in a column with the criterions header string on top. - */ - void addCriterion(const Dune::Solvers::Criterion& criterion) - { - monitors_.push_back(Dune::Solvers::Criterion(criterion)); - } - /** * \brief Add a convergence criterion * @@ -79,14 +60,14 @@ public: * print the diagnostic string returned by the criterion * in a column with the criterions header string on top. * - * This is a convenience method that just forwards all - * arguments to the constructor of Dune::Solvers::Criterion. - * Refer to the documentation of the latter for details. + * This method forward all arguments to the constructor of + * Criterion. So you can pass a Criterion or any argument + * list supported by the Criterion constructors. */ template<class... Args> - void addCriterion(const Args&... args) + void addCriterion(Args&&... args) { - monitors_.push_back(Dune::Solvers::Criterion(args...)); + monitors_.emplace_back(std::forward<Args>(args)...); } /** -- GitLab