Lifetime guarantees for geometry objects obtained through the grid interface
I found this very surprising many times before, so I thought I'll open an issue.
I understand I only get "wrappers" from the grid when I call
a loop over the grid.
for (const auto& element : elements(leafGridView)) for (const auto& intersection : intersections(leafGridView, element)) ...
Still a really (in my opinion) natural thing to do would be to store some of the geometries and do something with them later. In this sense I wanna use them as real geometry objects like the name suggests. Meaning I want value semantics (if I'm using that right). But unfortunately, e.g. for ALUGrid, I only get pointers to some internally cached version that changes when I go to the next element.
Is there a way to achieve this (without manually constructing a copy of the geometry by extracting type and corners) that I'm missing? Do such guarantees exist since 2.6 for other objects like entities?
This also seems like a problem for thread safety if there are internal mutable caches. But I guess that could be solved without too much interface restrictions by each grid implementation by locking internally?