From d562f2c1cc0f1531941d034a7aab23c201cdea59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Thu, 26 Oct 2023 08:43:27 +0200
Subject: [PATCH] [timeloop][setcp] use init_list over vector

The overload with iterators allow insertion from preexisting containers,
while the overload with std::vector allowed for a terser syntax like
`setCheckPoint({1.0, 2.0})`. But template instantiation failed with this
type of syntax because the scalar type on vector could not be deduced.
---
 dumux/common/timeloop.hh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh
index e096378787..2285772504 100644
--- a/dumux/common/timeloop.hh
+++ b/dumux/common/timeloop.hh
@@ -17,6 +17,7 @@
 #include <iomanip>
 #include <chrono>
 #include <type_traits>
+#include <initializer_list>
 
 #include <dune/common/float_cmp.hh>
 #include <dune/common/timer.hh>
@@ -631,12 +632,17 @@ public:
     }
 
     /*!
-     * \brief add checkpoints to the queue from a vector of time points
+     * \brief add checkpoints to the queue from a list of time points
      * \note checkpoints have to be provided in ascending order
-     * \param checkPoints the vector of check points
+     * \param checkPoints the list of check points
      * \note This also updates the time step size and potentially reduces the time step size to meet the next check point
      */
     template<class ScalarOrDuration>
+    void setCheckPoint(const std::initializer_list<ScalarOrDuration>& checkPoints)
+    { setCheckPoint(checkPoints.begin(), checkPoints.end()); }
+
+    template<class ScalarOrDuration>
+    [[deprecated("Use setCheckpoint(begin, end) instead. Will be removed after release 3.9.")]]
     void setCheckPoint(const std::vector<ScalarOrDuration>& checkPoints)
     { setCheckPoint(checkPoints.begin(), checkPoints.end()); }
 
-- 
GitLab