Skip to content

Commit 733e919

Browse files
author
Sébastien Gonzalve
committed
Make operator-> const
Having this operator non-const is awkward as operator* is const. This sometimes leads to writing: (*obj).data; instead of obj->data; which is unexpected....
1 parent a95d816 commit 733e919

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gtsam/nonlinear/Values.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ namespace gtsam {
189189
const_iterator_type it_;
190190
deref_iterator(const_iterator_type it) : it_(it) {}
191191
ConstKeyValuePair operator*() const { return {it_->first, *(it_->second)}; }
192-
std::unique_ptr<ConstKeyValuePair> operator->() {
192+
std::unique_ptr<ConstKeyValuePair> operator->() const {
193193
return std::make_unique<ConstKeyValuePair>(it_->first, *(it_->second));
194194
}
195195
bool operator==(const deref_iterator& other) const {

0 commit comments

Comments
 (0)