CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of the interface.
More...
#include "llvm/ADT/iterator.h"
Inherits iterator< IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >.
Inherited by llvm::detail::zip_common< ZipType, Iters >, llvm::iterator_adaptor_base< DerivedT, WrappedIteratorT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >, llvm::detail::zip_common< zip_first< Iters... >, Iters... >, and llvm::detail::zip_common< zip_shortest< Iters... >, Iters... >.
|
class | ReferenceProxy |
| A proxy object for computing a reference via indirecting a copy of an iterator. More...
|
|
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
class llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of the interface.
Use this when it is reasonable to implement most of the iterator functionality in terms of a core subset. If you need special behavior or there are performance implications for this, you may want to override the relevant members instead.
Note, one abstraction that this does not provide is implementing subtraction in terms of addition by negating the difference. Negation isn't always information preserving, and I can see very reasonable iterator designs where this doesn't work well. It doesn't really force much added boilerplate anyways.
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)
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);
Definition at line 68 of file iterator.h.
◆ anonymous enum
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
Enumerator |
---|
IsRandomAccess | |
IsBidirectional | |
Definition at line 72 of file iterator.h.
◆ operator!=()
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator+()
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
DerivedT llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator+ |
( |
DifferenceTypeT |
n | ) |
const |
|
inline |
◆ operator++() [1/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator++() [2/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator-()
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
DerivedT llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator- |
( |
DifferenceTypeT |
n | ) |
const |
|
inline |
◆ operator--() [1/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator--() [2/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator->() [1/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator->() [2/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator<=()
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator>()
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator>=()
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator[]() [1/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator[]() [2/2]
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ operator+
template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
DerivedT operator+ |
( |
DifferenceTypeT |
n, |
|
|
const DerivedT & |
i |
|
) |
| |
|
friend |
The documentation for this class was generated from the following file: