(beforeBegin, beforeEnd] range idiom is not standard
Dune uses (`beforeBegin()`, `beforeEnd()`] as a range in order to make backward sweeps in several algorithms. However, there are 2 issues that make this idiom non-standard: * Implementations like `Matrix` in dune-istl preform operations on pointers one before the data. [This is undefined behavior](https://stackoverflow.com/a/58990188) and may lead to pessimization of the compiler at best (e.g., a compiler thinks this should not happen and tries a clever trick) and data corruption at worst (e.g., a system with segmented memory where incrementing the pointer does not lead to the correct data). For more info about the UB in pointer arithmetic check out this [blog](https://www.learncpp.com/cpp-tutorial/pointer-arithmetic-and-subscripting/) and [the wording](https://eel.is/c++draft/expr.add#4https://eel.is/c++draft/expr.add%234) in the current C++ draft. * Implementations like `DenseVector` and `DenseMatrix` in dune-common provide iterators that are an instance of `RandomAccessIteratorFacade`. However, despite its name, this type is not truly random access iterator since they have to be [totally ordered](https://en.cppreference.com/cpp/iterator/random_access_iterator?__cf_chl_tk=0pxgZL5dd07d2Y.0QE8a6GW.RKXJXXax.JCFAv3wzng-1778152279-1.0.1.1-jTuAOkQhNuh6gL4YXf.BPkSHBTlrlfWYPwSkFhUxkfo) to qualify as such. One of the problems to make this a truly random access iterator (e.g., by using the newer `IteratorFacade`) is that the (`beforeBegin()`, `beforeEnd()`] idiom would brake. This is because, in some cases, `beforeBegin()` stores an index that is `std::numeric_limits<size_type>::max()`, thus, breaking several invariants like `beforeBegin() <= beforeEnd()`. Switching the index to a signed integer to allow to point one before the beginning is a waste of the index range, and would lead to several other compilation issues. The argument for a dedicated (`beforeBegin()`, `beforeEnd()`] seems to be that other kinds of loops are slow. However, this seems to be **not** true, at least with [GCC 13](https://quick-bench.com/q/A9-bnwOtPza1nmydkoCbOV1G_N8), [Clang 17](https://quick-bench.com/q/gczJURmv5NXOtmPNSwM_Hl7g7wg), and my local tests on a M3 with Apple Clang 17. The usage of this idiom is also not very widespread on the user side. So far, I could only find it used in 8 places in dune-istl and 3 places in OPM. So I am confident that a replacement with reverse iterators is feasible. Unless someone has a better idea to fix these problems, I would propose that we should switch to [reversed iterators](https://en.cppreference.com/cpp/iterator/reverse_iterator) where needed, and deprecate the (`beforeBegin()`, `beforeEnd()`] range idiom. It is better to have marginally slower code than broken code.
issue