From 6491cb939566b3a58786f8c3562bee87e4f2a467 Mon Sep 17 00:00:00 2001 From: Billy Donahue Date: Mon, 21 Dec 2020 04:41:37 -0500 Subject: [PATCH] `Json::ValueIterator` operators `*` and `->` need to be const Fixes #1249. --- include/json/value.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/json/value.h b/include/json/value.h index ec9af5666..7ec418571 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -918,8 +918,8 @@ class JSON_API ValueIterator : public ValueIteratorBase { * because the returned references/pointers can be used * to change state of the base class. */ - reference operator*() { return deref(); } - pointer operator->() { return &deref(); } + reference operator*() const { return const_cast(deref()); } + pointer operator->() const { return const_cast(&deref()); } }; inline void swap(Value& a, Value& b) { a.swap(b); }