LLVM  9.0.0svn
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > Class Template Reference

An iterator adaptor that filters the elements of given inner iterators. More...

#include "llvm/ADT/STLExtras.h"

Inheritance diagram for llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >:
Inheritance graph
[legend]
Collaboration diagram for llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >:
Collaboration graph
[legend]

Public Member Functions

filter_iterator_baseoperator++ ()
 
- Public Member Functions inherited from llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > & operator+= (difference_type n)
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > & operator-= (difference_type n)
 
difference_type operator- (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > & operator++ ()
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > & operator-- ()
 
bool operator== (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
bool operator< (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::reference, typename std::iterator_traits< WrappedIteratorT >::value_type & >::type operator* () const
 
- Public Member Functions inherited from llvm::iterator_facade_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, std::common_type< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type, typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::difference_type, typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::pointer, typename std::iterator_traits< WrappedIteratorT >::value_type * >::type, typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::reference, typename std::iterator_traits< WrappedIteratorT >::value_type & >::type >
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > operator+ (typename std::iterator_traits< WrappedIteratorT >::difference_type n) const
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > operator- (typename std::iterator_traits< WrappedIteratorT >::difference_type n) const
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > & operator++ ()
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > operator++ (int)
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > & operator-- ()
 
filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > operator-- (int)
 
bool operator!= (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
bool operator> (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
bool operator<= (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
bool operator>= (const filter_iterator_base< WrappedIteratorT, PredicateT, IterTag > &RHS) const
 
typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::pointer, typename std::iterator_traits< WrappedIteratorT >::value_type *>::type operator-> ()
 
typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::pointer, typename std::iterator_traits< WrappedIteratorT >::value_type *>::type operator-> () const
 
ReferenceProxy operator[] (typename std::iterator_traits< WrappedIteratorT >::difference_type n)
 
ReferenceProxy operator[] (typename std::iterator_traits< WrappedIteratorT >::difference_type n) const
 

Protected Member Functions

void findNextValid ()
 
 filter_iterator_base (WrappedIteratorT Begin, WrappedIteratorT End, PredicateT Pred)
 
- Protected Member Functions inherited from llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
 iterator_adaptor_base ()=default
 
 iterator_adaptor_base (WrappedIteratorT u)
 
const WrappedIteratorT & wrapped () const
 

Protected Attributes

WrappedIteratorT End
 
PredicateT Pred
 
- Protected Attributes inherited from llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
WrappedIteratorT I
 

Additional Inherited Members

- Public Types inherited from llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
using difference_type = typename std::iterator_traits< WrappedIteratorT >::difference_type
 
- Protected Types inherited from llvm::iterator_facade_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, std::common_type< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type, typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::difference_type, typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::pointer, typename std::iterator_traits< WrappedIteratorT >::value_type * >::type, typename std::conditional< std::is_same< typename std::iterator_traits< WrappedIteratorT >::value_type, typename std::iterator_traits< WrappedIteratorT >::value_type >::value, typename std::iterator_traits< WrappedIteratorT >::reference, typename std::iterator_traits< WrappedIteratorT >::value_type & >::type >
enum  
 

Detailed Description

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
class llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >

An iterator adaptor that filters the elements of given inner iterators.

The predicate parameter should be a callable object that accepts the wrapped iterator's reference type and returns a bool. When incrementing or decrementing the iterator, it will call the predicate on each element and skip any where it returns false.

int A[] = { 1, 2, 3, 4 };
auto R = make_filter_range(A, [](int N) { return N % 2 == 1; });
// R contains { 1, 3 }.

Note: filter_iterator_base implements support for forward iteration. filter_iterator_impl exists to provide support for bidirectional iteration, conditional on whether the wrapped iterator supports it.

Definition at line 315 of file STLExtras.h.

Constructor & Destructor Documentation

◆ filter_iterator_base()

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::filter_iterator_base ( WrappedIteratorT  Begin,
WrappedIteratorT  End,
PredicateT  Pred 
)
inlineprotected

Definition at line 341 of file STLExtras.h.

Member Function Documentation

◆ findNextValid()

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
void llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::findNextValid ( )
inlineprotected

Definition at line 333 of file STLExtras.h.

◆ operator++()

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
filter_iterator_base& llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::operator++ ( )
inline

Definition at line 350 of file STLExtras.h.

Member Data Documentation

◆ End

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
WrappedIteratorT llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::End
protected

Definition at line 330 of file STLExtras.h.

◆ Pred

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
PredicateT llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::Pred
protected

Definition at line 331 of file STLExtras.h.


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