]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce std_cxx20::ranges::iota_range.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 2 May 2020 18:07:59 +0000 (12:07 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 7 May 2020 12:40:15 +0000 (06:40 -0600)
include/deal.II/base/std_cxx20/iota_view.h [new file with mode: 0644]

diff --git a/include/deal.II/base/std_cxx20/iota_view.h b/include/deal.II/base/std_cxx20/iota_view.h
new file mode 100644 (file)
index 0000000..8c2b346
--- /dev/null
@@ -0,0 +1,48 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+#ifndef dealii_cxx20_iota_view_h
+#define dealii_cxx20_iota_view_h
+
+#include <deal.II/base/config.h>
+
+#include <boost/range/irange.hpp>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+namespace std_cxx20
+{
+  namespace ranges
+  {
+    /**
+     * A poor-man's implementation of std::ranges::iota_view using
+     * boost's integer_range class. The two classes are not completely
+     * identical, but close enough so that we can use the boost
+     * class until std::ranges::iota_range becomes available in
+     * compilers.
+     *
+     * The std::ranges::iota_view class represents a range of values
+     * or iterators that one can loop over. A documentation of this
+     * class can be found at
+     * https://en.cppreference.com/w/cpp/ranges/iota_view .
+     */
+    template <typename IncrementableType>
+    using iota_view = boost::integer_range<IncrementableType>;
+  } // namespace ranges
+} // namespace std_cxx20
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif

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.