[PATCH] D28726: Adding const overloads of operator* and operator-> for DenseSet iterators
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 16 10:21:52 PST 2017
Arguably: Test coverage?
On Fri, Jan 13, 2017 at 11:36 PM Hugo Puhlmann via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
> hstefan updated this revision to Diff 84436.
> hstefan added a comment.
>
> Now both classes have overloads for operator-> and operator* in a uniform
> way.
>
>
> https://reviews.llvm.org/D28726
>
> Files:
> include/llvm/ADT/DenseSet.h
>
>
> Index: include/llvm/ADT/DenseSet.h
> ===================================================================
> --- include/llvm/ADT/DenseSet.h
> +++ include/llvm/ADT/DenseSet.h
> @@ -104,7 +104,9 @@
> Iterator(const typename MapTy::iterator &i) : I(i) {}
>
> ValueT &operator*() { return I->getFirst(); }
> + const ValueT &operator*() const { return I->getFirst(); }
> ValueT *operator->() { return &I->getFirst(); }
> + const ValueT *operator->() const { return &I->getFirst(); }
>
> Iterator& operator++() { ++I; return *this; }
> Iterator operator++(int) { auto T = *this; ++I; return T; }
> @@ -125,8 +127,8 @@
>
> ConstIterator(const typename MapTy::const_iterator &i) : I(i) {}
>
> - const ValueT &operator*() { return I->getFirst(); }
> - const ValueT *operator->() { return &I->getFirst(); }
> + const ValueT &operator*() const { return I->getFirst(); }
> + const ValueT *operator->() const { return &I->getFirst(); }
>
> ConstIterator& operator++() { ++I; return *this; }
> ConstIterator operator++(int) { auto T = *this; ++I; return T; }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170116/4f56b84e/attachment.html>
More information about the llvm-commits
mailing list