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"
Inherited by llvm::FixedStreamArrayIterator< PSHashRecord >, llvm::MIBundleOperandIteratorBase< const MachineOperand >, llvm::MIBundleOperandIteratorBase< MachineOperand >, llvm::StringMapIterBase< StringMapConstIterator< ValueTy >, const StringMapEntry< ValueTy > >, llvm::StringMapIterBase< StringMapIterator< ValueTy >, StringMapEntry< ValueTy > >, llvm::concat_iterator< GlobalValue, iterator, global_iterator, alias_iterator, ifunc_iterator >, llvm::detail::zip_common< zip_enumerator< Iters... >, EnumeratorTupleType< Iters... >, Iters... >, llvm::detail::zip_common< zip_first< Iters... >, ZipTupleType< Iters... >::type, Iters... >, llvm::detail::zip_common< zip_shortest< Iters... >, ZipTupleType< Iters... >::type, Iters... >, llvm::indexed_accessor_iterator< iterator, BaseT, T, PointerT, ReferenceT >, llvm::iterator_adaptor_base< AACallEdgeIterator, SetVector< Function * >::iterator >, llvm::iterator_adaptor_base< IteratorImpl< ValueT, IteratorBase >, IteratorBase, std::bidirectional_iterator_tag, ValueT >, llvm::iterator_adaptor_base< const_succ_op_iterator, const_value_op_iterator, std::random_access_iterator_tag, const BasicBlock *, ptrdiff_t, const BasicBlock *, const BasicBlock * >, llvm::iterator_adaptor_base< succ_op_iterator, value_op_iterator, std::random_access_iterator_tag, BasicBlock *, ptrdiff_t, BasicBlock *, BasicBlock * >, llvm::iterator_adaptor_base< const_value_iterator, ListTy::const_iterator, std::forward_iterator_tag, const DIEValue >, llvm::iterator_adaptor_base< value_iterator, ListTy::iterator, std::forward_iterator_tag, DIEValue >, llvm::iterator_adaptor_base< const_child_iterator, const_child_iterator_base >, llvm::iterator_adaptor_base< const_toplevel_iterator, const_toplevel_iterator_base >, llvm::iterator_adaptor_base< ChildIteratorType, SmallVector< BoUpSLP::EdgeInfo, 1 >::iterator >, llvm::iterator_adaptor_base< ImutAVLValueIterator< ImmutableMap >, T::TreeTy::iterator, std::iterator_traits< T::TreeTy::iterator >::iterator_category, const T::value_type >, llvm::iterator_adaptor_base< ImutAVLValueIterator< ImmutableMapRef >, T::TreeTy::iterator, std::iterator_traits< T::TreeTy::iterator >::iterator_category, const T::value_type >, llvm::iterator_adaptor_base< ImutAVLValueIterator< T >, T::TreeTy::iterator, std::iterator_traits< T::TreeTy::iterator >::iterator_category, const T::value_type >, llvm::iterator_adaptor_base< call_iterator, VectorImplT::iterator, std::forward_iterator_tag >, llvm::iterator_adaptor_base< iterator, VectorImplT::iterator, std::forward_iterator_tag >, llvm::iterator_adaptor_base< WrappedSuccIterator, succ_iterator, std::iterator_traits< succ_iterator >::iterator_category, NodeRef, std::ptrdiff_t, NodeRef *, NodeRef >, llvm::iterator_adaptor_base< MCRegUnitIterator, MCRegisterInfo::DiffListIterator, std::forward_iterator_tag, const MCRegUnit >, llvm::iterator_adaptor_base< MCSubRegIterator, MCRegisterInfo::DiffListIterator, std::forward_iterator_tag, const MCPhysReg >, llvm::iterator_adaptor_base< MCSuperRegIterator, MCRegisterInfo::DiffListIterator, std::forward_iterator_tag, const MCPhysReg >, llvm::iterator_adaptor_base< const_symbol_iterator, SymbolsMapType::const_iterator, std::forward_iterator_tag, const Symbol *, ptrdiff_t, const Symbol *, const Symbol * >, llvm::iterator_adaptor_base< value_op_iterator, op_iterator, std::random_access_iterator_tag, SDValue, ptrdiff_t, value_op_iterator *, value_op_iterator * >, llvm::iterator_adaptor_base< StringMapKeyIterator< ValueTy >, StringMapConstIterator< ValueTy >, std::forward_iterator_tag, StringRef >, llvm::iterator_adaptor_base< const_value_op_iterator, const_op_iterator, std::random_access_iterator_tag, const Value *, ptrdiff_t, const Value *, const Value * >, llvm::iterator_adaptor_base< value_op_iterator, op_iterator, std::random_access_iterator_tag, Value *, ptrdiff_t, Value *, Value * >, llvm::iterator_adaptor_base< DbgAssignIt, Value::user_iterator, std::iterator_traits< Value::user_iterator >::iterator_category, DbgAssignIntrinsic *, std::ptrdiff_t, DbgAssignIntrinsic **, DbgAssignIntrinsic *& >, llvm::iterator_adaptor_base< early_inc_iterator_impl< WrappedIteratorT >, WrappedIteratorT, std::input_iterator_tag >, llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type_t< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category > >, llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, std::forward_iterator_tag >, WrappedIteratorT, std::common_type_t< std::forward_iterator_tag, std::iterator_traits< WrappedIteratorT >::iterator_category > >, llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, std::bidirectional_iterator_tag >, WrappedIteratorT, std::common_type_t< std::bidirectional_iterator_tag, std::iterator_traits< WrappedIteratorT >::iterator_category > >, llvm::iterator_adaptor_base< mapped_iterator< ItTy, FuncTy >, ItTy, std::iterator_traits< ItTy >::iterator_category, std::remove_reference_t< decltype(std::declval< FuncTy >()(*std::declval< ItTy >())) >, std::iterator_traits< ItTy >::difference_type, std::remove_reference_t< decltype(std::declval< FuncTy >()(*std::declval< ItTy >())) > *, decltype(std::declval< FuncTy >()(*std::declval< ItTy >())) >, llvm::iterator_adaptor_base< DerivedT, ItTy, std::iterator_traits< ItTy >::iterator_category, std::remove_reference_t< ReferenceTy >, std::iterator_traits< ItTy >::difference_type, std::remove_reference_t< ReferenceTy > *, ReferenceTy >, llvm::iterator_adaptor_base< GSIHashIterator, FixedStreamArrayIterator< PSHashRecord >, std::random_access_iterator_tag, const uint32_t >, llvm::iterator_adaptor_base< NeighborEdgeIteratorT< IsConst, IsOut >, typename NeighborSetT::const_iterator, std::iterator_traits< typename NeighborSetT::const_iterator >::iterator_category, std::conditional_t< IsConst, const EdgeValueType, EdgeValueType > >, llvm::memoryaccess_def_iterator_base< MemoryAccess >, llvm::BasicBlock::phi_iterator_impl< PHINodeT, BBIteratorT >, llvm::def_chain_iterator< T, UseOptimizedChain >, llvm::detail::zip_common< ZipType, ReferenceTupleType, Iters >, llvm::indexed_accessor_iterator< DerivedT, BaseT, T, PointerT, ReferenceT >, llvm::iterator_adaptor_base< DerivedT, WrappedIteratorT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >, and llvm::scc_iterator< GraphT, GT >.
|
class | PointerProxy |
| A proxy object for computing a pointer via indirecting a copy of a reference. More...
|
|
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.
Iterators are expected to have const rules analogous to pointers, with a single, const-qualified operator*() that returns ReferenceT. This matches the second and third pointers in the following example:
{
const int *
I = &Value; }
{
const int *
const I = &
Value; }
LLVM Value Representation.
If an iterator facade returns a handle to its own state, then T (and PointerT and ReferenceT) should usually be const-qualified. Otherwise, if clients are expected to modify the handle itself, the field can be declared mutable or use const_cast.
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;
- T &operator*() const;
- 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 80 of file iterator.h.
◆ difference_type
template<typename DerivedT , typename IteratorCategoryT , typename
T , typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
using llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::difference_type = DifferenceTypeT |
◆ iterator_category
template<typename DerivedT , typename IteratorCategoryT , typename
T , typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
using llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >::iterator_category = IteratorCategoryT |
◆ pointer
template<typename DerivedT , typename IteratorCategoryT , typename
T , typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ reference
template<typename DerivedT , typename IteratorCategoryT , typename
T , typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ value_type
template<typename DerivedT , typename IteratorCategoryT , typename
T , typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *, typename ReferenceT = T &>
◆ 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 89 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->()
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[]()
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: