LLVM 22.0.0git
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 >:
[legend]

Public Member Functions

filter_iterator_baseoperator++ ()
decltype(auto) operator* () const
decltype(auto) operator-> () const
Public Member Functions inherited from llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type_t< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category > >
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-- ()
std::conditional_t< 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 & > operator* () const
Public Member Functions inherited from llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >
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
PointerProxy operator-> () const
ReferenceProxy operator[] (DifferenceTypeT n) const

Protected Member Functions

void findNextValid ()
 filter_iterator_base ()=default
 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_t< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category > >
 iterator_adaptor_base ()=default
const WrappedIteratorTwrapped () 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_t< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category > >
WrappedIteratorT I

Additional Inherited Members

Public Types inherited from llvm::iterator_adaptor_base< filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >, WrappedIteratorT, std::common_type_t< IterTag, std::iterator_traits< WrappedIteratorT >::iterator_category > >
using difference_type
Public Types inherited from llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >
using iterator_category = IteratorCategoryT
using value_type = T
using difference_type = DifferenceTypeT
using pointer = PointerT
using reference = ReferenceT
Protected Types inherited from llvm::iterator_facade_base< DerivedT, IteratorCategoryT, T, DifferenceTypeT, PointerT, ReferenceT >
enum  { IsRandomAccess , IsBidirectional }

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 }.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
Definition STLExtras.h:552
#define N

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 433 of file STLExtras.h.

Constructor & Destructor Documentation

◆ filter_iterator_base() [1/2]

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::filter_iterator_base ( )
protecteddefault

Referenced by operator++().

◆ filter_iterator_base() [2/2]

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 456 of file STLExtras.h.

References End, findNextValid(), and Pred.

Member Function Documentation

◆ findNextValid()

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

Definition at line 446 of file STLExtras.h.

References End, and Pred.

Referenced by filter_iterator_base(), and operator++().

◆ operator*()

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
decltype(auto) llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::operator* ( ) const
inline

Definition at line 471 of file STLExtras.h.

References assert(), and End.

◆ operator++()

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

Definition at line 465 of file STLExtras.h.

References filter_iterator_base(), and findNextValid().

◆ operator->()

template<typename WrappedIteratorT, typename PredicateT, typename IterTag>
decltype(auto) llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >::operator-> ( ) const
inline

Definition at line 476 of file STLExtras.h.

References assert(), and End.

Member Data Documentation

◆ End

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

Definition at line 443 of file STLExtras.h.

Referenced by filter_iterator_base(), findNextValid(), operator*(), and operator->().

◆ Pred

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

Definition at line 444 of file STLExtras.h.

Referenced by filter_iterator_base(), and findNextValid().


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