[PATCH] Define iterator_traits for ImmutableSet::iterator
Aaron Ballman
aaron at aaronballman.com
Wed Feb 13 05:24:56 PST 2013
On Tue, Feb 12, 2013 at 9:20 PM, Ryan Govostes <rgovostes+git at gmail.com> wrote:
> http://llvm-reviews.chandlerc.com/D401
>
> Files:
> include/llvm/ADT/ImmutableSet.h
>
> Index: include/llvm/ADT/ImmutableSet.h
> ===================================================================
> --- include/llvm/ADT/ImmutableSet.h
> +++ include/llvm/ADT/ImmutableSet.h
> @@ -1066,6 +1066,12 @@
> inline bool operator==(const iterator& RHS) const { return RHS.itr == itr; }
> inline bool operator!=(const iterator& RHS) const { return RHS.itr != itr; }
> inline value_type *operator->() const { return &(operator*()); }
> +
> + typedef int difference_type;
I think signed might be preferable over int here.
> + typedef ImmutableSet<ValT,ValInfo>::value_type value_type;
> + typedef value_type *pointer;
> + typedef value_type &reference;
> + typedef std::bidirectional_iterator_tag iterator_category;
> };
>
> iterator begin() const { return iterator(Root); }
Otherwise, patch LGTM!
~Aaron
More information about the llvm-commits
mailing list