Closed
Description
Describe the bug
As discovered in #1216, The C++20 std::reverse_iterator<ValueIterator>
cannot perform ->
, at least not in GCC.
This is because ValueIterator
operators ->
and *
are const
-incorrect.
To Reproduce
Json::Value v;
v["k1"] = "v1";
std::reverse_iterator it(value.end());
auto s = it->asString(); // This fails to compile, but `(*it).asString()`; is fine.
Expected behavior
operator->
and operator*
should be const
in ValueIterator
as they are in ValueConstIterator
.
Dereferencing an iterator is always a logical const operation, as providing such access does not change the iterator.
Desktop (please complete the following information):
- OS: in my case, MacOS, using homebrew GCC-10.
- Meson version N/A
- Ninja version N/A
Additional context
A commit was made for this on #1216, but we could make it a standalone bugfix independent of C++20.
14e15b6
Metadata
Metadata
Assignees
Labels
No labels