Into

Modules

Documentation

classPiiBinaryFunctionIterator

#include <PiiIterator.h>

An iterator that uses two iterators in parallel and transforms their values using a binary function.

Description

Given two iterators it1 and it2, and a function func, this iterator returns func(*it1, *it2).

 // Store the difference of vec1 and vec2 to vec1
 QVector<int> vec1(5), vec2(5), vec3(5);
 Pii::copyN(Pii::binaryFunctionIterator(vec1.begin(), vec2.begin(), std::minus<int>()),
            vec1.size(), vec1.begin());

Public types

typedef std::iterator_traits< Iterator1 >::difference_type
typedef std::iterator_traits< Iterator1 >::iterator_category
typedef value_type *
typedef value_type &
typedef BinaryFunction::result_type

Constructors and destructor

Constructs a copy of other.

(
  • Iterator1 iterator1
  • Iterator2 iterator2
  • const BinaryFunction & func
)

Constructs an iterator that transforms iterator1 and iterator2 with func.

Public member functions

bool

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

value_type

Returns func(*iterator1, *iterator2).

Increments both iterator1 and iterator2.

(
  • int
)

Increments both iterator1 and iterator2.

(
  • difference_type i
)

Moves both iterators forwards i elements.

difference_type

Returns the difference between iterator1 members of this and other.

Decrements both iterator1 and iterator2.

(
  • int
)

Decrements both iterator1 and iterator2.

(
  • difference_type i
)

Moves both iterators backwards i elements.

bool
bool

Copies other and returns a reference to this.

bool

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

bool
bool
value_type
(
  • difference_type index
)

Returns a new PiiBinaryFunctionIterator that is initialized with iterator1[index] and iterator2[index].

template<class Iterator1, class Iterator2, class BinaryFunction>
PiiBinaryFunctionIterator< Iterator1, Iterator2, BinaryFunction >
(
  • Iterator1 iterator1
  • Iterator2 iterator2
  • const BinaryFunction & func
)

Create an iterator that transforms iterator1 and iterator2 with func.

Function details

  • PiiBinaryFunctionIterator

    ( )
    [inline]

    Constructs a copy of other.

  • PiiBinaryFunctionIterator

    (
    • Iterator1 iterator1
    • Iterator2 iterator2
    • const BinaryFunction & func
    )
    [inline]

    Constructs an iterator that transforms iterator1 and iterator2 with func.

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

  • bool operator!=

    ( )
    [inline]

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

  • value_type operator*

    ()
    [inline]

    Returns func(*iterator1, *iterator2).

  • PiiBinaryFunctionIterator & operator++

    ()
    [inline]

    Increments both iterator1 and iterator2.

    Returns a reference to this.

  • PiiBinaryFunctionIterator operator++

    (
    • int
    )
    [inline]

    Increments both iterator1 and iterator2.

    Returns a copy of this.

  • PiiBinaryFunctionIterator & operator+=

    (
    • difference_type i
    )
    [inline]

    Moves both iterators forwards i elements.

    Returns a reference to this.

  • difference_type operator-

    ( )
    [inline]

    Returns the difference between iterator1 members of this and other.

  • PiiBinaryFunctionIterator & operator--

    ()
    [inline]

    Decrements both iterator1 and iterator2.

    Returns a reference to this.

  • PiiBinaryFunctionIterator operator--

    (
    • int
    )
    [inline]

    Decrements both iterator1 and iterator2.

    Returns a copy of this.

  • PiiBinaryFunctionIterator & operator-=

    (
    • difference_type i
    )
    [inline]

    Moves both iterators backwards i elements.

    Returns a reference to this.

  • bool operator<</h4>

    (

    )
    [inline]
  • bool operator<=

    ( )
    [inline]
  • PiiBinaryFunctionIterator & operator=

    ( )
    [inline]

    Copies other and returns a reference to this.

  • bool operator==

    ( )
    [inline]

    Returns true if the iterator1 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 PiiBinaryFunctionIterator that is initialized with iterator1[index] and iterator2[index].

  • template<class Iterator1, class Iterator2, class BinaryFunction>

    PiiBinaryFunctionIterator< Iterator1, Iterator2, BinaryFunction > binaryFunctionIterator

    (
    • Iterator1 iterator1
    • Iterator2 iterator2
    • const BinaryFunction & func
    )

    Create an iterator that transforms iterator1 and iterator2 with func.

Notes (0)

Add a note

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