This is an archive of the discontinued LLVM Phabricator instance.

Add better documentation for iterator facade subclasses.
ClosedPublic

Authored by zturner on Jan 6 2017, 2:11 PM.

Details

Reviewers
chandlerc

Diff Detail

Event Timeline

zturner updated this revision to Diff 83424.Jan 6 2017, 2:11 PM
zturner retitled this revision from to Add better documentation for iterator facade subclasses..
zturner updated this object.
zturner added a reviewer: chandlerc.
zturner added a subscriber: llvm-commits.
chandlerc added inline comments.Jan 6 2017, 3:23 PM
llvm/include/llvm/ADT/iterator.h
45–49

For both forward and bidirectional, you can instead implement (one overload of) operator++ and operator-- respectively. Generally, that's a better option for such iterators.

For random-access, you can skip implementing those because we can generate them from the += and -= (which we have to have you implement in order for random access to be fast).

zturner updated this revision to Diff 83640.Jan 9 2017, 9:28 AM
chandlerc accepted this revision.Jan 10 2017, 1:35 PM
chandlerc edited edge metadata.

Awesome, thanks for making this more clear!

This revision is now accepted and ready to land.Jan 10 2017, 1:35 PM
zturner closed this revision.Mar 12 2017, 11:36 AM

This was submitted a while ago.