Silicon Graphics, Inc.

iter_swap

Category: algorithms Component type: function

Prototype

template <class ForwardIterator1, class ForwardIterator2>
inline void iter_swap(ForwardIterator1 a, ForwardIterator2 b);

Description

Equivalent to swap(*a, *b). [1]

Definition

Declared in algo.h. The implementation is in algobase.h.

Requirements on types

Preconditions

Complexity

See swap for a discussion.

Example

int x = 1;
int y = 2;
assert(x == 1 && y == 2);
iter_swap(&x, &y);
assert(x == 2 && y == 1);

Notes

[1] Strictly speaking, iter_swap is redault Constructible.

The distance type must, as described in the Input Iterator requirements, be a signed integral type.

Public base classes

None.

Members

Member Where defined Description
istream_iterator() istream_iterator See below.
istream_iterator(istream&) istream_iterator See below.
istream_iterator(const istream_iterator&) Trivial Iterator The copy constructor
ist