Skip to content

Commit fe9663e

Browse files
BillyDonahuecdunn2001
authored andcommitted
Json::ValueIterator operators * and -> need to be const
Fixes #1249.
1 parent 5c4219b commit fe9663e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: include/json/value.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,8 @@ class JSON_API ValueIterator : public ValueIteratorBase {
918918
* because the returned references/pointers can be used
919919
* to change state of the base class.
920920
*/
921-
reference operator*() { return deref(); }
922-
pointer operator->() { return &deref(); }
921+
reference operator*() const { return const_cast<reference>(deref()); }
922+
pointer operator->() const { return const_cast<pointer>(&deref()); }
923923
};
924924

925925
inline void swap(Value& a, Value& b) { a.swap(b); }

0 commit comments

Comments
 (0)