Into

Modules

Documentation

classPiiFilteredIterator

#include <PiiIterator.h>

An iterator that picks selected elements out of another iterator.

Description

PiiFilteredIterator is initialized with two ranges of equal length: the range to be filtered an the filter. When advanced, PiiFilteredIterator steps over items whose corresponding element in the filter range is zero.

Public types

typedef std::iterator_traits< Iterator >::difference_type
typedef std::iterator_traits< Iterator >::iterator_category
typedef Pii::If< bConst, const value_type *, value_type * >::Type
typedef Pii::If< bConst, const value_type &, value_type & >::Type
typedef std::iterator_traits< Iterator >::value_type

Constructors and destructor

(
  • const Iterator & begin
  • const Iterator & end
  • const FilterIterator & filter
)

Constructs a new filtered iterator that works in the range [begin, end).

(
  • const Iterator & begin
  • const Iterator & end
  • const Iterator & current
  • const FilterIterator & filter
)

Constructs a new filtered iterator that works in the range [begin, end).

Constructs a copy of other.

Public member functions

Iterator
( )
Iterator
Iterator
( )
FilterIterator
( )
bool
( )

Returns false if the iterator members of this and other are equal, and true otherwise.

value_type

Returns the current value of iterator.

reference

Increments iterator and filter until *filter is non-zero.

(
  • int
)

Increments both iterator and filter.

(
  • difference_type i
)

Moves both iterators forwards i elements.

(
  • int
)

Decrements both iterator and filter.

Decrements iterator and filter until *filter is non-zero.

(
  • difference_type i
)

Moves both iterators backwards i elements.

bool
bool
( )
( )

Copies other and returns a reference to this.

bool
( )

Returns true if the iterator members of this and other are equal, and false otherwise.

bool
( )
bool
( )
(
  • difference_type index
)

Returns a new PiiFilteredIterator that is initialized with iterator[index] and filter[index].

template<class Iterator, class FilterIterator>
PiiFilteredIterator< Iterator, FilterIterator >
(
  • Iterator begin
  • Iterator end
  • FilterIterator filter
)

Create an iterator that accesses the elements in the range [begin, end) that match filter.

template<class Iterator, class FilterIterator>
PiiFilteredIterator< Iterator, FilterIterator >
(
  • Iterator begin
  • Iterator end
  • Iterator current
  • FilterIterator filter
)

Create an iterator that accesses the elements in the range [begin, end) that match filter.

Function details

  • PiiFilteredIterator

    (
    • const Iterator & begin
    • const Iterator & end
    • const FilterIterator & filter
    )
    [inline]

    Constructs a new filtered iterator that works in the range [begin, end).

    The start of the filter range is filter. The current item is set to the first item in the range whose corresponding element in filter is non-zero.

  • PiiFilteredIterator

    (
    • const Iterator & begin
    • const Iterator & end
    • const Iterator & current
    • const FilterIterator & filter
    )
    [inline]

    Constructs a new filtered iterator that works in the range [begin, end).

    The start of the filter range is filter. The current item is placed at current, which must be within the range.

  • PiiFilteredIterator

    ( )
    [inline]

    Constructs a copy of other.

  • Iterator begin

    ()
    [inline]
  • Iterator current

    ()
    [inline]
  • Iterator end

    ()
    [inline]
  • FilterIterator filter

    ()
    [inline]
  • bool operator!=

    ( )
    [inline]

    Returns false if the iterator members of this and other are equal, and true otherwise.

  • value_type operator*

    ()
    [inline]

    Returns the current value of iterator.

  • reference operator*

    ()
    [inline]

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

  • PiiFilteredIterator & operator++

    ()
    [inline]

    Increments iterator and filter until *filter is non-zero.

    Returns a reference to this.

  • PiiFilteredIterator operator++

    (
    • int
    )
    [inline]

    Increments both iterator and filter.

    Returns a copy of this.

  • PiiFilteredIterator & operator+=

    (
    • difference_type i
    )
    [inline]

    Moves both iterators forwards i elements.

    Returns a reference to this.

  • PiiFilteredIterator operator--

    (
    • int
    )
    [inline]

    Decrements both iterator and filter.

    Returns a copy of this.

  • PiiFilteredIterator & operator--

    ()
    [inline]

    Decrements iterator and filter until *filter is non-zero.

    Returns a reference to this.

  • PiiFilteredIterator & operator-=

    (
    • difference_type i
    )
    [inline]

    Moves both iterators backwards i elements.

    Returns a reference to this.

  • bool operator<</h4>

    (

    )
    [inline]
  • bool operator<=

    ( )
    [inline]
  • PiiFilteredIterator & operator=

    ( )
    [inline]

    Copies other and returns a reference to this.

  • bool operator==

    ( )
    [inline]

    Returns true if the iterator members of this and other are equal, and false otherwise.

  • bool operator>

    ( )
    [inline]
  • bool operator>=

    ( )
    [inline]
  • PiiFilteredIterator operator[]

    (
    • difference_type index
    )
    [inline]

    Returns a new PiiFilteredIterator that is initialized with iterator[index] and filter[index].

  • template<class Iterator, class FilterIterator>

    PiiFilteredIterator< Iterator, FilterIterator > filteredIterator

    (
    • Iterator begin
    • Iterator end
    • FilterIterator filter
    )

    Create an iterator that accesses the elements in the range [begin, end) that match filter.

    The iterator will be initially moved to the first element matching the filter.

  • template<class Iterator, class FilterIterator>

    PiiFilteredIterator< Iterator, FilterIterator > filteredIterator

    (
    • Iterator begin
    • Iterator end
    • Iterator current
    • FilterIterator filter
    )

    Create an iterator that accesses the elements in the range [begin, end) that match filter.

    The iterator will be initially placed at current.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.