From 2901ee18f824d1f9e4338ef2853da0ab4ccbff0e Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Wed, 18 Nov 2020 14:45:52 -0800 Subject: [PATCH] Add -> operator overload for cd* iterators. (#5464) --- src/context/cdhashmap.h | 1 + src/context/cdhashset.h | 1 + src/context/cdlist.h | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/context/cdhashmap.h b/src/context/cdhashmap.h index 77c9012ff..afcfb00a9 100644 --- a/src/context/cdhashmap.h +++ b/src/context/cdhashmap.h @@ -418,6 +418,7 @@ public: // Dereference operators. const value_type& operator*() const { return d_it->getValue(); } + const value_type* operator->() const { return &d_it->getValue(); } // Prefix increment iterator& operator++() diff --git a/src/context/cdhashset.h b/src/context/cdhashset.h index 9bbf6537c..c8dcc7888 100644 --- a/src/context/cdhashset.h +++ b/src/context/cdhashset.h @@ -115,6 +115,7 @@ public: V operator*() const { return d_val; } + V* operator->() const { return &d_val; } };/* class CDSet<>::iterator::Proxy */ // Actual postfix increment: returns Proxy with the old value. diff --git a/src/context/cdlist.h b/src/context/cdlist.h index 89bf2b5e8..cb5e552ac 100644 --- a/src/context/cdlist.h +++ b/src/context/cdlist.h @@ -357,6 +357,8 @@ public: return *d_it; } + inline const T* operator->() const { return d_it; } + /** Prefix increment */ const_iterator& operator++() { ++d_it; -- 2.30.2