From: Zachary Turner Date: Wed, 11 Jan 2017 00:34:41 +0000 (+0000) Subject: Add better documentation for iterator facade subclasses. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70b1ff1543997c1b9efd4e84c33a3d71610abe24;p=llvm Add better documentation for iterator facade subclasses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291625 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/iterator.h b/include/llvm/ADT/iterator.h index 9ccacc10db0..6470e09db86 100644 --- a/include/llvm/ADT/iterator.h +++ b/include/llvm/ADT/iterator.h @@ -33,6 +33,32 @@ namespace llvm { /// Another abstraction that this doesn't provide is implementing increment in /// terms of addition of one. These aren't equivalent for all iterator /// categories, and respecting that adds a lot of complexity for little gain. +/// +/// Classes wishing to use `iterator_facade_base` should implement the following +/// methods: +/// +/// Forward Iterators: +/// (All of the following methods) +/// - DerivedT &operator=(const DerivedT &R); +/// - bool operator==(const DerivedT &R) const; +/// - const T &operator*() const; +/// - T &operator*(); +/// - DerivedT &operator++(); +/// +/// Bidirectional Iterators: +/// (All methods of forward iterators, plus the following) +/// - DerivedT &operator--(); +/// +/// Random-access Iterators: +/// (All methods of bidirectional iterators excluding the following) +/// - DerivedT &operator++(); +/// - DerivedT &operator--(); +/// (and plus the following) +/// - bool operator<(const DerivedT &RHS) const; +/// - DifferenceTypeT operator-(const DerivedT &R) const; +/// - DerivedT &operator+=(DifferenceTypeT N); +/// - DerivedT &operator-=(DifferenceTypeT N); +/// template