From d1459f04d66078e48a0d705b19cb140f4098c6b2 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 2 May 2020 12:07:59 -0600 Subject: [PATCH] Introduce std_cxx20::ranges::iota_range. --- include/deal.II/base/std_cxx20/iota_view.h | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 include/deal.II/base/std_cxx20/iota_view.h 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 index 0000000000..8c2b34606b --- /dev/null +++ b/include/deal.II/base/std_cxx20/iota_view.h @@ -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 + +#include + + +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 + using iota_view = boost::integer_range; + } // namespace ranges +} // namespace std_cxx20 + +DEAL_II_NAMESPACE_CLOSE + +#endif -- 2.39.5