Into

Modules

Documentation

classPiiUnaryFunctionIterator

#include <PiiIterator.h>

An iterator that transforms another iterator using a unary function.

Description

Given a function func and an iterator it, this iterator returns func(*it).

 // Add two to all elements of vec1 and store the result to vec2
 QVector<int> vec1(5), vec2(5);
 Pii::copyN(Pii::unaryFunctionIterator(vec1.begin(), std::bind2nd(std::plus<int>(), 2)),
            vec1.size(), vec2.begin());

Public types

typedef std::iterator_traits< Iterator >::difference_type
typedef std::iterator_traits< Iterator >::iterator_category
typedef value_type *
typedef value_type &
typedef UnaryFunction::result_type

Constructors and destructor

Constructs a copy of other.

(
  • Iterator iterator
  • const UnaryFunction & func
)

Constructs an iterator that transforms iterator with func.

Public member functions

bool

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

value_type

Returns func(*iterator).

Increments iterator and returns a reference to this.

(
  • int
)

Increments iterator and returns a copy of this.

(
  • difference_type i
)

Moves iterator forwards i elements.

difference_type

Returns the difference between iterator members of this and other.

Decrements iterator and returns a reference to this.

(
  • int
)

Decrements iterator and returns a copy of this.

(
  • difference_type i
)

Moves iterator 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
value_type
(
  • difference_type index
)

Returns a new PiiUnaryFunctionIterator that is initialized with iterator[index].

template<class Iterator, class UnaryFunction>
PiiUnaryFunctionIterator< Iterator, UnaryFunction >
(
  • Iterator iterator
  • const UnaryFunction & func
)

Create an iterator that transforms iterator with func.

Function details

  • PiiUnaryFunctionIterator

    ( )
    [inline]

    Constructs a copy of other.

  • PiiUnaryFunctionIterator

    (
    • Iterator iterator
    • const UnaryFunction & func
    )
    [inline]

    Constructs an iterator that transforms iterator with func.

    This constructor is seldom used explicitly; use the Pii::unaryFunctionIterator() function instead.

  • bool operator!=

    ( )
    [inline]

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

  • value_type operator*

    ()
    [inline]

    Returns func(*iterator).

  • PiiUnaryFunctionIterator & operator++

    ()
    [inline]

    Increments iterator and returns a reference to this.

  • PiiUnaryFunctionIterator operator++

    (
    • int
    )
    [inline]

    Increments iterator and returns a copy of this.

  • PiiUnaryFunctionIterator & operator+=

    (
    • difference_type i
    )
    [inline]

    Moves iterator forwards i elements.

    Returns a reference to this.

  • difference_type operator-

    ( )
    [inline]

    Returns the difference between iterator members of this and other.

  • PiiUnaryFunctionIterator & operator--

    ()
    [inline]

    Decrements iterator and returns a reference to this.

  • PiiUnaryFunctionIterator operator--

    (
    • int
    )
    [inline]

    Decrements iterator and returns a copy of this.

  • PiiUnaryFunctionIterator & operator-=

    (
    • difference_type i
    )
    [inline]

    Moves iterator backwards i elements.

    Returns a reference to this.

  • bool operator<</h4>

    (

    )
    [inline]
  • bool operator<=

    ( )
    [inline]
  • PiiUnaryFunctionIterator & 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]
  • value_type operator[]

    (
    • difference_type index
    )
    [inline]

    Returns a new PiiUnaryFunctionIterator that is initialized with iterator[index].

  • template<class Iterator, class UnaryFunction>

    PiiUnaryFunctionIterator< Iterator, UnaryFunction > unaryFunctionIterator

    (
    • Iterator iterator
    • const UnaryFunction & func
    )

    Create an iterator that transforms iterator with func.

Notes (0)

Add a note

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