]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Work around a BOOST issue with C++20. 17071/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 23 May 2024 19:54:18 +0000 (13:54 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 23 May 2024 20:23:33 +0000 (14:23 -0600)
include/deal.II/numerics/rtree.h

index d132a6d9f59d733369643b0655fdc12dd1e2ff1e..2ee8a697f66de27f08ada95f1357e5e8d4fd4ee9 100644 (file)
@@ -498,9 +498,17 @@ RTree<typename ContainerType::size_type,
       IndexableGetterFromIndices<ContainerType>>
 pack_rtree_of_indices(const ContainerType &container)
 {
-  std_cxx20::ranges::iota_view<typename ContainerType::size_type,
-                               typename ContainerType::size_type>
-    indices(0, container.size());
+  // We need an array that holds the indices we want to pack. The rtree
+  // implementation in BOOST, for reasons not entirely clear, insists
+  // on using a reference to the elements of the range. This is fine if
+  // the indices are stored in a container, so that's what we do.
+  // (It would be nice if we could just pass a std::ranges::iota_view
+  // instead, but that has no nested 'reference' type, and this then
+  // trips up BOOST rtree.)
+  std::vector<typename ContainerType::size_type> indices(container.size());
+  for (typename ContainerType::size_type i = 0; i < container.size(); ++i)
+    indices[i] = i;
+
   return RTree<typename ContainerType::size_type,
                IndexType,
                IndexableGetterFromIndices<ContainerType>>(

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.