Debian Codegraph @

include/deal.II/base/std_cxx20/iota_view.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2020 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14 #ifndef dealii_cxx20_iota_view_h
15 #define dealii_cxx20_iota_view_h
16
17 #include <deal.II/base/config.h>
18
19 #ifdef DEAL_II_HAVE_CXX20
20 # include <ranges>
21 #else
22 # include <boost/range/irange.hpp>
23 #endif
24
25 DEAL_II_NAMESPACE_OPEN
26
27 namespace std_cxx20
28 {
29 namespace ranges
30 {
31 #ifndef DEAL_II_HAVE_CXX20
32 /**
33 * A poor-man's implementation of std::ranges::iota_view using
34 * boost's integer_range class. The two classes are not completely
35 * identical, but close enough so that we can use the boost
36 * class until std::ranges::iota_range becomes available in
37 * compilers.
38 *
39 * The std::ranges::iota_view class represents a range of values
40 * or iterators that one can loop over. A documentation of this
41 * class can be found at
42 * https://en.cppreference.com/w/cpp/ranges/iota_view .
43 */
44 template <typename IncrementableType, typename /*BoundType*/>
45 using iota_view = boost::integer_range<IncrementableType>;
46 #else
47 using std::ranges::iota_view;
48 #endif
49 } // namespace ranges
50 } // namespace std_cxx20
51
52 DEAL_II_NAMESPACE_CLOSE
53
54 #endif