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....release/4.3a0
parent
a95d816f37
commit
733e919570
|
@ -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<ConstKeyValuePair> operator->() {
|
||||
std::unique_ptr<ConstKeyValuePair> operator->() const {
|
||||
return std::make_unique<ConstKeyValuePair>(it_->first, *(it_->second));
|
||||
}
|
||||
bool operator==(const deref_iterator& other) const {
|
||||
|
|
Loading…
Reference in New Issue