LLVM API Documentation

Public Member Functions | Protected Types | Friends
llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT > Class Template Reference

CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of the interface. More...

#include <iterator.h>

Inheritance diagram for llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

DerivedT operator+ (DifferenceTypeT n) const
DerivedT operator- (DifferenceTypeT n) const
DerivedT & operator++ ()
DerivedT operator++ (int)
DerivedT & operator-- ()
DerivedT operator-- (int)
bool operator!= (const DerivedT &RHS) const
bool operator> (const DerivedT &RHS) const
bool operator<= (const DerivedT &RHS) const
bool operator>= (const DerivedT &RHS) const
PointerT operator-> () const
ReferenceT operator[] (DifferenceTypeT n) const

Protected Types

enum  { IsRandomAccess, IsBidirectional }

Friends

DerivedT operator+ (DifferenceTypeT n, const DerivedT &i)

Detailed Description

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.

Definition at line 38 of file iterator.h.


Member Enumeration Documentation

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
anonymous enum [protected]
Enumerator:
IsRandomAccess 
IsBidirectional 

Definition at line 42 of file iterator.h.


Member Function Documentation

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
bool llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator!= ( const DerivedT &  RHS) const [inline]

Definition at line 96 of file iterator.h.

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]

Definition at line 50 of file iterator.h.

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++ ( ) [inline]
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++ ( int  ) [inline]

Definition at line 76 of file iterator.h.

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]

Definition at line 64 of file iterator.h.

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-- ( ) [inline]
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-- ( int  ) [inline]

Definition at line 87 of file iterator.h.

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
PointerT llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator-> ( ) const [inline]

Reimplemented in llvm::User::value_op_iterator.

Definition at line 120 of file iterator.h.

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
bool llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator<= ( const DerivedT &  RHS) const [inline]

Definition at line 107 of file iterator.h.

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
bool llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator> ( const DerivedT &  RHS) const [inline]

Definition at line 100 of file iterator.h.

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
bool llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator>= ( const DerivedT &  RHS) const [inline]

Definition at line 113 of file iterator.h.

template<typename DerivedT, typename IteratorCategoryT, typename T, typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
ReferenceT llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::operator[] ( DifferenceTypeT  n) const [inline]

Definition at line 123 of file iterator.h.


Friends And Related Function Documentation

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]

Definition at line 58 of file iterator.h.


The documentation for this class was generated from the following file: