LLVM  6.0.0svn
Classes | Public Member Functions | Friends | List of all members
llvm::filter_iterator< WrappedIteratorT, PredicateT > 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< WrappedIteratorT, PredicateT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::filter_iterator< WrappedIteratorT, PredicateT >:
Collaboration graph
[legend]

Public Member Functions

filter_iteratoroperator++ ()
 
- Public Member Functions inherited from llvm::iterator_adaptor_base< filter_iterator< WrappedIteratorT, PredicateT >, WrappedIteratorT, std::common_type< std::forward_iterator_tag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
filter_iterator< WrappedIteratorT, PredicateT > & operator+= (difference_type n)
 
filter_iterator< WrappedIteratorT, PredicateT > & operator-= (difference_type n)
 
difference_type operator- (const filter_iterator< WrappedIteratorT, PredicateT > &RHS) const
 
filter_iterator< WrappedIteratorT, PredicateT > & operator++ ()
 
filter_iterator< WrappedIteratorT, PredicateT > & operator-- ()
 
bool operator== (const filter_iterator< WrappedIteratorT, PredicateT > &RHS) const
 
bool operator< (const filter_iterator< WrappedIteratorT, PredicateT > &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< WrappedIteratorT, PredicateT >, std::common_type< std::forward_iterator_tag, 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< WrappedIteratorT, PredicateT > operator+ (typename std::iterator_traits< WrappedIteratorT >::difference_type n) const
 
filter_iterator< WrappedIteratorT, PredicateT > operator- (typename std::iterator_traits< WrappedIteratorT >::difference_type n) const
 
filter_iterator< WrappedIteratorT, PredicateT > & operator++ ()
 
filter_iterator< WrappedIteratorT, PredicateT > operator++ (int)
 
filter_iterator< WrappedIteratorT, PredicateT > & operator-- ()
 
filter_iterator< WrappedIteratorT, PredicateT > operator-- (int)
 
bool operator!= (const filter_iterator< WrappedIteratorT, PredicateT > &RHS) const
 
bool operator> (const filter_iterator< WrappedIteratorT, PredicateT > &RHS) const
 
bool operator<= (const filter_iterator< WrappedIteratorT, PredicateT > &RHS) const
 
bool operator>= (const filter_iterator< WrappedIteratorT, PredicateT > &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
 

Friends

template<typename RT , typename PT >
iterator_range< filter_iterator< detail::IterOfRange< RT >, PT > > make_filter_range (RT &&, PT)
 

Additional Inherited Members

- Public Types inherited from llvm::iterator_adaptor_base< filter_iterator< WrappedIteratorT, PredicateT >, WrappedIteratorT, std::common_type< std::forward_iterator_tag, 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< WrappedIteratorT, PredicateT >, std::common_type< std::forward_iterator_tag, 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  
 
- Protected Member Functions inherited from llvm::iterator_adaptor_base< filter_iterator< WrappedIteratorT, PredicateT >, WrappedIteratorT, std::common_type< std::forward_iterator_tag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
 iterator_adaptor_base ()=default
 
 iterator_adaptor_base (WrappedIteratorT u)
 
const WrappedIteratorT & wrapped () const
 
- Protected Attributes inherited from llvm::iterator_adaptor_base< filter_iterator< WrappedIteratorT, PredicateT >, WrappedIteratorT, std::common_type< std::forward_iterator_tag, std::iterator_traits< WrappedIteratorT >::iterator_category >::type >
WrappedIteratorT I
 

Detailed Description

template<typename WrappedIteratorT, typename PredicateT>
class llvm::filter_iterator< WrappedIteratorT, PredicateT >

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 }.

Definition at line 270 of file STLExtras.h.

Member Function Documentation

◆ operator++()

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

Definition at line 312 of file STLExtras.h.

References llvm::make_filter_range().

Friends And Related Function Documentation

◆ make_filter_range

template<typename WrappedIteratorT, typename PredicateT>
template<typename RT , typename PT >
iterator_range<filter_iterator<detail::IterOfRange<RT>, PT> > make_filter_range ( RT &&  ,
PT   
)
friend

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