json/include/nlohmann/detail/iterators
Florian Albrechtskirchinger 700b95f447
Make iterator operator++/--(int) equality-preserving (#3332)
Commit f28fc22 introduced const qualifiers on post-(inc-/dec-)rement
operators of iterators. These qualifiers prevent the use of basic_json
in place of std::ranges::range, which requires the post-increment
operator to be equality-preserving.

These changes appear to be the result of ICC compiler suggestions, and
no further explanation is discernible from the PR discussion (#858).
Further testing revealed, that clang-tidy also suggests adding const to
prevent "accidental mutation of a temporary object".

As an alternative, this commit partially reverts f28fc22, removing all
added const qualifiers from return types and adds lvalue reference
qualifiers to the operator member functions instead.

Unit tests ensure the operators remain equality-preserving and
accidental mutation of temporaries following post-(inc-/dec-)rement is
prohibited.

Fixes #3331.
2022-03-08 10:10:50 +01:00
..
internal_iterator.hpp 🚨 remove warnings 2020-06-22 22:32:21 +02:00
iter_impl.hpp Make iterator operator++/--(int) equality-preserving (#3332) 2022-03-08 10:10:50 +01:00
iteration_proxy.hpp All: fix warnings when compiling with -Wswitch-enum 2021-08-12 16:33:50 +02:00
iterator_traits.hpp 🎨 replace alternative operators (and, not, or) 2020-06-03 14:20:36 +02:00
json_reverse_iterator.hpp Make iterator operator++/--(int) equality-preserving (#3332) 2022-03-08 10:10:50 +01:00
primitive_iterator.hpp Make iterator operator++/--(int) equality-preserving (#3332) 2022-03-08 10:10:50 +01:00