Currently prevector iterators have many issues:
- Forward iterators (and stronger) must be default constructible (https://eel.is/c++draft/forward.iterators#1.2). Otherwise, some functions can not be instantiated, like
std::minmax_element
. - Various
const
issues with random access iterators. For example, aconst iterator
is different from aconst_iterator
, because the first one holds a mutable reference and must also return it withoutconst
. Also,operator+
must be callable regardless of the iterator object’sconst
-ness. - When adding an offset to random access iterators, both
x+n
andn+x
must be specified, see https://eel.is/c++draft/random.access.iterators#tab:randomaccessiterator
Fix all issues.
Also, upgrade the std::random_access_iterator_tag
(C++17) to std::contiguous_iterator_tag
(C++20)