Fix potential UB in reverse iteration loops
Replaced reverse iteration logic (e.g., using beforeEnd() and --iterator) with standard std::reverse_iterator. This ensures correct and reverse traversal, avoiding potential Undefined Behavior with pointer based iterator implementations (e.g. Imp::base_array_unmanaged::RealIterator).
A reference on why the current approach is undefined behavior is explained in dune-common#430. For more info about the UB in pointer arithmetic check out this blog and the wording in the current C++ draft.
- Check that previous behavior is maintained.
Edited by Santiago Ospina de los Ríos