From fe9663e7edaf5c179af9c42ffd47428b83f8842a 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 ec9af56..7ec4185 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -918,8 +918,8 @@ public: * 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); }