diff --git a/gtsam/nonlinear/Values.h b/gtsam/nonlinear/Values.h index 21e8e281f9..2fe64d9c91 100644 --- a/gtsam/nonlinear/Values.h +++ b/gtsam/nonlinear/Values.h @@ -189,7 +189,7 @@ namespace gtsam { const_iterator_type it_; deref_iterator(const_iterator_type it) : it_(it) {} ConstKeyValuePair operator*() const { return {it_->first, *(it_->second)}; } - std::unique_ptr operator->() { + std::unique_ptr operator->() const { return std::make_unique(it_->first, *(it_->second)); } bool operator==(const deref_iterator& other) const {